i have a java game app that uses sockets to communicate with each other.
the issue is when i do a socket listen (server), i can run another instance of the game on the same machine using the same port as before to listen, and it results in listening again. now i have two instances of the application both listening on the same port. you can imagine only one connects when a connection comes through.
the question is: how do i prevent the app from listening on the same port as another instance is already listening to?
thanks in advance.
EDIT: serverSocket = new ServerSocket(serverPort, backlog);
im using this. should i try to use: ServerSocket(int port, int backlog, InetAddress bindAddr)
instead?
EDIT: SOLVED! i did not handle the exception only trapped it. now it is working well. thanks for your inputs.