network query
-
I have a windows client application, which I want to use to communicate with a server application running on a different machine in the same LAN. To make it user friendly, instead of asking the user to input the host IP addres of the server to the client application, I want the client application to do a query in the LAN, and find out what the candidate server's IP address is, and all the user has to do is to confirm that that's the one to communicate with. I have no clue how I can get this done. Any hint would be greatly appreciated. Thanks a lot!
-
I have a windows client application, which I want to use to communicate with a server application running on a different machine in the same LAN. To make it user friendly, instead of asking the user to input the host IP addres of the server to the client application, I want the client application to do a query in the LAN, and find out what the candidate server's IP address is, and all the user has to do is to confirm that that's the one to communicate with. I have no clue how I can get this done. Any hint would be greatly appreciated. Thanks a lot!
-
ravi, Thank you for the link. but the server I am thinking of is not a generic server. It's just an application which runs on another computer, but serves as server in a client/server software. maybe I can use broadcast function, but is there any better way to implement it? for example, D-Link has a network storage adapter DNS-120. It has a built-in FTP server, so files can be accessed over the internet, when the disk is connected to this adapter. It has an application called "Easy Search", which is to easily locate DNS-120 units for configuration. What I want is similar to this "Easy Search", that is, click a button on this "Easy Search" application, it will return the IP addresses of my "DNS-120" units in the same LAN. English is not first language, so I hope I made myself a bit more clear now. Thank you for any hint!
-
ravi, Thank you for the link. but the server I am thinking of is not a generic server. It's just an application which runs on another computer, but serves as server in a client/server software. maybe I can use broadcast function, but is there any better way to implement it? for example, D-Link has a network storage adapter DNS-120. It has a built-in FTP server, so files can be accessed over the internet, when the disk is connected to this adapter. It has an application called "Easy Search", which is to easily locate DNS-120 units for configuration. What I want is similar to this "Easy Search", that is, click a button on this "Easy Search" application, it will return the IP addresses of my "DNS-120" units in the same LAN. English is not first language, so I hope I made myself a bit more clear now. Thank you for any hint!
lucy wrote:
application called "Easy Search",
Discovery mechanisms such as this (and license severs) work by listening on a specific port. The server code needs to support a ping/ack request, in which case, all you need to do is ping the specific port on all visible servers in your LAN. The ones that respond are eligible candidates for your client. The ping/ack support can be made more useful if the server is smart enough to return additional information (eg: load, etc.) which would make it easier for your clients to select the appropriate one. Hope this helps! /ravi PS: Your English is fine. :)
This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com
-
lucy wrote:
application called "Easy Search",
Discovery mechanisms such as this (and license severs) work by listening on a specific port. The server code needs to support a ping/ack request, in which case, all you need to do is ping the specific port on all visible servers in your LAN. The ones that respond are eligible candidates for your client. The ping/ack support can be made more useful if the server is smart enough to return additional information (eg: load, etc.) which would make it easier for your clients to select the appropriate one. Hope this helps! /ravi PS: Your English is fine. :)
This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com
thank you very much, ravi. now I understand the principle. Is there any tutorial material I can read to learn more? I'm pretty new to the network programming. what I have done is limited to very basic stuff, such as one-to-one send/recv applciation. thanks again!
-
I have a windows client application, which I want to use to communicate with a server application running on a different machine in the same LAN. To make it user friendly, instead of asking the user to input the host IP addres of the server to the client application, I want the client application to do a query in the LAN, and find out what the candidate server's IP address is, and all the user has to do is to confirm that that's the one to communicate with. I have no clue how I can get this done. Any hint would be greatly appreciated. Thanks a lot!
lucy wrote:
I want the client application to do a query in the LAN, and find out what the candidate server's IP address is...
Use NetServerEnum() for this. Once you can successfully enumerate through all machines in your LAN, then you can go about "pinging" their ports.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
lucy wrote:
I want the client application to do a query in the LAN, and find out what the candidate server's IP address is...
Use NetServerEnum() for this. Once you can successfully enumerate through all machines in your LAN, then you can go about "pinging" their ports.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
thank you, this is very helpful. I then found this article: http://www.codeproject.com/internet/ipaddress.asp[^] now I'm on my way to the solution. Thanks again!
lucy wrote:
I then found this article: http://www.codeproject.com/internet/ipaddress.asp\[^\]
It seems to have an unnecessary call to
gethostname()
, asszHostName
is not used for anything. :confused:
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb