tmazight wrote:Loss of messages will only happen if you don't write your code correctly. So if you want a single thread to handle both connections, you have to ask yourself what you want to happen if the server is processing low-priority data and then some high-priority data becomes available. Is the server allowed to process both of them at the same time? If not, what is your upper bound for the time that the high-priority data connection can wait before being processed?
it is possible to let one thread handle two connections of a client on two different ports(one for simple data, the other for urgent) by switching on the two sockets of the two connections without lost of messages? if it is not possible and i guess it's the case,
then is there an issue to identify the incoming connections, to regroup the socket for urgent data and socket for simple data for each client and give priority for the urgent data (knowing that i will have two selector one for each server Socket).There shouldn't be. If you write the code correctly then you keep track of which connections belong to which client.
I know that my questions are philosophical, that's because I'm new to network programming and i have to take a decision: NIO or IO.I wouldn't call them "philosophical". They are just symptomatic of you doing things in the wrong order. NIO versus IO is a low-level design detail, which you shouldn't really be considering until you have a high-level design, or architecture, in your hand. Nothing which you asked there has any bearing on the NIO versus IO decision.