-
[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.
-
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.
-
Re: Find a server
Enumerate all machines on the network. Then scan through them all to see which one has the port open.
-
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
-
Re: Find a server
Thanks, Lozzenger, that was the clue I needed.