Hi
I’m rewriting some network code (again), and as part of doing this I’ve read blahblahblah’s doc, one thing I wasn’t aware of is that when you write your byte buffer to a non blocking socketchannel it might not write all the bytes. So what I was thinking of is having a thread on the client, and one on the server, that selects on op_write (only those channels which messages have been send for are registered) that blocks on on the select and then carries on pumping bytes down till either it can’t send any more, in which case it reregisters that channel, or the message is sent. This is more of a design question, but I’m after comments. My reading is done by calling poll on my endpoints, but this just calls selectNow on the channels that are registered for op_read. The only reason I think I need this thread to handle the writes is that I don’t want to rely on the poll being called for writing messages, if I only poll say 10 times a second then my latency will be at least 100ms, for any message that can’t be written in one go, on top of the actual network lag.
Comments/suggestions?
Cheers
Endolf