|
-
Feb 22nd, 2007, 06:14 PM
#1
Thread Starter
PowerPoster
[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
-
Feb 23rd, 2007, 06:27 AM
#2
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.
-
Feb 23rd, 2007, 09:23 AM
#3
Re: Find a server
Enumerate all machines on the network. Then scan through them all to see which one has the port open.
-
Mar 6th, 2007, 10:35 AM
#4
Member
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
-
Mar 8th, 2007, 12:32 PM
#5
Thread Starter
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|