Take the 2-minute tour ×

Is it possible to run two NIO Server sockets on a single port? I am using Apache MINA for server sockets. I am running a one server on port 8090 and simultaneously is it possible to run another server on the same port?

share|improve this question
Apparently only if using UDP. See this thread for a starter: stackoverflow.com/questions/1694144/… –  Alex Sep 3 '12 at 6:39
What is the point of doing this? If both servers do the same, then one sever is enough. If they behave different, how are you going to determine which connection goes to which server? –  Alexei Kaigorodov Sep 3 '12 at 7:01
I want to use Jboss application server and socket server on a single port. –  Rocky Sep 3 '12 at 7:04
add comment

1 Answer

up vote 2 down vote accepted

Not if they are both using TCP, unless they are both bound to different interfaces. What would be the point exactly? They would both just sit there accepting connections. One is as good as a thousand.

share|improve this answer
I dint get you. Could you please elaborate the answer. –  Rocky Sep 3 '12 at 6:54
@Rocky +1 The OS determines which service/ServerSort to use by IP address and port alone. If you were to listen twice, the OS would have no way of knowing which service should be called. Instead the application should listen once and decide which service should be used based on content, load balancing or source IP address. –  Peter Lawrey Sep 3 '12 at 7:21
@Rocky Which part of 'not' don't you understand? I've already asked you to elaborate your question. Why do you think you want to do this? –  EJP Sep 3 '12 at 8:02
I want to use Jboss application server and socket server on a single port. So I want to know whether it is possible or not –  Rocky Sep 3 '12 at 8:27
add comment

Your Answer


