windows socket programming

Dear All

I have two applications(visual 2012 c++ win 32). One runs on a device connected to my PC and the other one a desktop app which communicates with the connected device. I can display message in the device by writing in the device application code in my PC. When I run both the applications, whatever is displayed on the device, I can also display the same on my PC via desktop application.

I have just written down my IP address directly in the code for the device. Is there any way, by which my application can ask for the IP address from the user and once he enters, the device application is able to communicate with desktop app. In this way, the user Dont have to directly enter the IP address in the code.

Any suggestions will be greatly appreciated.
I'll do you one better, use the function "getaddrinfo()" from the WinAPI to get the hosts IP address from the local DNS. This will have the added bonus of not requiring the server to use a static address. That function will take the PC name as a C-string.
Topic archived. No new replies allowed.