On Saturday 29 April 2006 02:37, Roshan wrote:
- Code snip
/*Server code*/ int listeningport=0;
Umm...shouldn't that be 4000? Servers are generally created on a fixed port. Thats why they are called servers...
I believe, there is nothing wrong with the code, it creates a server at a free port now, but takes too long around 9-10 mintues
Umm...isn't that kinda obvious. If you start it at port 0, it will take a long time to determine a free port. Remember what I told you earlier, only root processes are allowed to bind to the first 1024 ports. That prolly explains why it takes so long for it to determine a free port. And eewwww...you should've mentioned that you're doing this in Java...
are you converting host to network and network to host correctly?
What am I supposed to do for this, exactly? Everything is running on localhost!
I dont think you need to do it in Java but you never mentioned which language you were using. So I assumed C.
Anyway, try googling the next time. This is the right way to build a client / server: http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html