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?
Asked
Active
Viewed 175 times
0
-
2Apparently only if using UDP. See this thread for a starter: http://stackoverflow.com/questions/1694144/can-two-applications-listen-to-the-same-port – Alex Sep 03 '12 at 06: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 03 '12 at 07:01
-
I want to use Jboss application server and socket server on a single port. – Rocky Sep 03 '12 at 07:04
1 Answers
2
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.

user207421
- 305,947
- 44
- 307
- 483
-
-
@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 03 '12 at 07: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? – user207421 Sep 03 '12 at 08: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 03 '12 at 08:27