I have two small programs (server and client) that establish communication between two PCs connected with an ethernet cable. I was able to do so using Win sockets and static IPs on both machines.

Lately I had to enable the Internet connection sharing between the two, which made me change the TCP/IP connection properties to "Obtain an IP address automatically". Now I'm faced with a dilemma of IP constantly changing and thus my two programs not being able to communicate anymore.

I'm not really good at network programming. Can someone suggest what shall I do to obtain the IP address of a remote computer connected this way?