On 17/05/2019 16:04, Phil Hudson wrote:
Hi All,
I have 2 questions about the way NioSocketAcceptor allocates and uses
ports.
Background
We are using a 3^rd party product (QuickFix/J) for client/server
communication, which in turn uses
MINA for network communication. For server side communication,
QuickFix/J is instantiating a
NioSocketAcceptor for listening on a specified port. We recently
noticed an issue where a large number
of additional ports are also being allocated when a NioSocketAcceptor
is instantiated. We seem to
see around 10 ‘pairs’ of ports allocated (20 total) with each
instantiation. As you can see in the sample
below, they seem to be in pairs, where they talk to each other. ??
Proto Local Address Foreign Address State PID
TCP 127.0.0.1:55686 MYSYS:55687 ESTABLISHED 24976
TCP 127.0.0.1:55687 MYSYS:55686 ESTABLISHED 24976
TCP 127.0.0.1:55688 MYSYS:55689 ESTABLISHED 24976
TCP 127.0.0.1:55689 MYSYS:55688 ESTABLISHED 24976
…
Note that the actual port being listened on is a different port
altogether… example: port 6073
I have searched for why this is occurring, but can’t find any
documentation on it.
Questions
1) Why do 20 ports get allocated when a NioSocketAcceptor is instantiated?
1a) What is it using these ports for?
No idea. It all depends on the application using MINA.
2) Is there a way to control this? (or control the range it
allocates from?)
You have to ask the QuickFix/J fellows.
MINA is just a framework, it does what you tell it to do...
Quickly browsing their documentation, it seems they allow users to set a
failover mechanism, by which they start more than one acceptor:
https://www.quickfixj.org/usermanual/2.1.0/usage/acceptor_failover.html
but that might be unrelated. Just ask QuickFix/J people, they are the
ones who know :-)
And thanks them for using MINA ;-)