Hi I am hoping that someone can share thoughts on this problem that I have.
I am implementing a TFTP server on MINA 2. I have ProtocolCode for encoding and decoding. I have an ProtocolHandler that accepts TFTP message and produces repsonses. All good to far. But I have struck a bit of a brick wall with with aspect of the TFTP protocol - and am hoping that perhaps someone can share best practise (in a MINA context). Here it the sequence of TFTP messages I have to deal with: client (port A) ----- RRQ -----> server (port 69) // port 69 is the default TFTP listening port client (port A) <----DATA----- server (port X) // server choose a random port to continue talking to client on. client (port A) ----- ACK ------> server (port X) client (port A) <----DATA------ server (port X) .... I can see that NioDatagramAcceptor can accept binds to mutiple sockets so binding to port x for the duration of transmission is find - and unbinding is OK. This means the same single instance ProtocolCodec and a single instance ProtocolHandler can still be used for handling messages recieved on port 69 and any other ports. Nice ! THE PROBLEM ! But - I cannot see how to get the first DATA message to be sent on a new port, port X. Mina is going to try to send back via the port that the request was recieved from - port 69. (I can see that changing the client destination port is provided by 'session.write(packet, remoteAddress) in the IOSession object' - but nothing for the local address). Am I attemting to handle this case wrong ? Am I missng a feature of MINA that does handle this ? Many thanks in advance .
