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.

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

Edited 4 Years Ago by DavidKroukamp: n/a

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.

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.

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:

This question has already been answered. Start a new discussion instead.