Retrieve IP address of the adapter which my application is going to use.

Apr 8 2009 6:13 AM
Hi, I have a client application that communicates with other server modules residing on other machines. In client application, I need to know the IP address of the machine it is running on, so that it would communicate its IP to the server module(which could be separated from client by routers). Retrieving IP is not a problem. But when I retrieve IP, it gives IP of all the adapters present on the machine. How do I know using which IP it would communicate to the server module? Is there a way to resolve this?...or some functionality wherein I will pass the distination to connect to and it will return me the IP it is using for connection.