954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Sockets help!

I am making a networking application using sockets for a local area network. How can i make the client side of the application search the network for the server socket?
Right now i am getting the input from the user itself about the IP address and Port of the server.

battlex2010
Newbie Poster
15 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 
I am making a networking application using sockets for a local area network. How can i make the client side of the application search the network for the server socket? Right now i am getting the input from the user itself about the IP address and Port of the server.


why would you have to search the network?Each server will have its own IP and/or port and In each client application you should specify the server IP and port... and the client will then connect using the detail and throw an exception if a connection cannot be made... or maybe i misunderstood you

DavidKroukamp
Practically a Master Poster
Team Colleague
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169
 
How can i make the client side of the application search the network for the server socket?


Is that like trying to find someone's telephone number? You have to know it if you are going to call it.

NormR1
Posting Expert
Moderator
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
 

First: having your users input the server's IP address is probably the most proper way to do what you'd like.

If you try to simply crawl a network for a server you may run into problems. You need to know your network's structure to determine whether or not this approach is feasible. If a system on the network can get any IP address, then you're in trouble (since there are about 255^4 possible IP addresses). If there's a constrained number of address (such as all systems have an IP address like 192.168.0.xxx) then it may be possible to simply try accessing each IP.

dmanw100
Posting Whiz in Training
242 posts since Apr 2008
Reputation Points: 104
Solved Threads: 27
 

First: having your users input the server's IP address is probably the most proper way to do what you'd like.

If you try to simply crawl a network for a server you may run into problems. You need to know your network's structure to determine whether or not this approach is feasible. If a system on the network can get any IP address, then you're in trouble (since there are about 255^4 possible IP addresses). If there's a constrained number of address (such as all systems have an IP address like 192.168.0.xxx) then it may be possible to simply try accessing each IP.

Yes u are right i tried scanning the network using your method... it took ages to find and connect.. looks like i have to rely on the user :sad:

battlex2010
Newbie Poster
15 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: