Results 1 to 5 of 5

Thread: [RESOLVED] Find a server

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Resolved [RESOLVED] Find a server

    I know I just have a mental block, but how would a client find the IP of a server on the lan given the port number the server is listening on? I'm writing both parts, client and server, so nothing is out of my reach, but I just can't think of how to ask the lan who hears me on port XX (the port number can be anything). VB6 would be easiest, since the rest of the code is in VB6. I'm currently trying to use the Winsock control, but I'll use whatever works.

    I can ping the server if I know the IP, but I want to find the IP at runtime.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  2. #2
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Find a server

    The "LAN" is basically a wire. It doesn't know anything.

    You open connections using computer names, and rely on name resolution to locate the IP address to use. For global name resolution you rely on DNS, locally you rely on domain/workgroup name reolution. The "plumbing" to handle this is already built in.

  3. #3
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Find a server

    Enumerate all machines on the network. Then scan through them all to see which one has the port open.

  4. #4
    Member
    Join Date
    Jul 2006
    Posts
    47

    Re: Find a server

    Using UDP Protocol and an address of 255.255.255.255 will broadcast your message to the whole lan or subnet, your server could listen for this and respond with its ip details.

    Or you could try te solution I gave here which provides links to enumerating the machines in a domain and getting their ip addresses

    http://www.vbforums.com/showthread.php?t=455568

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Find a server

    Thanks, Lozzenger, that was the clue I needed.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

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