CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Get IP address on remote machine

    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?

  2. #2
    Join Date
    Feb 2009
    Location
    India
    Posts
    444

    Re: Get IP address on remote machine

    Try gethostbyname or getaddrinfo
    «_Superman
    I love work. It gives me something to do between weekends.

    Microsoft MVP (Visual C++)

  3. #3
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Get IP address on remote machine

    Quote Originally Posted by _Superman_ View Post
    Try gethostbyname or getaddrinfo
    This will give an IP of the machine those commands were run on, right? And I need the IP of machine connected via Ethernet cable through a network adapter.

  4. #4
    Join Date
    Mar 2009
    Posts
    2

    Re: Get IP address on remote machine


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured