I have a Java game app that uses sockets to communicate with each other.
The problem occurs when I listen to a socket (server), I can listen on the same machine using the same port on the same machine as before, to hear it, and then it Have to hear from Now I have two examples of both hearing applications at the same port. You can imagine that when a connection comes, then only one connects.
The question is: How can I stop listening to the app on a single port because another incident is already listening?
Thanks in advance.
Edit: ServerSocket = New ServerSet (server port, backlog);
I should try to use it by using IM: serverselect (int port, int backlog, inputdender binded)
instead?
EDIT: Solution! I did not handle the exception, only got trapped in it. Now it is working well. Thanks for your input.
It is not possible to listen to the same port with the same IP for two applications. The second application will receive an exception "port already in use".
Comments
Post a Comment