14
For p300, I am currently using a Selector to check if I can read from or write to a socket.
However, this has lead me to a weird problem: select is called for at most 30 seconds and I get a timeout for writing even though this can’t really be and only happens with some OS combinations. I’ve found this thread in the Sun Forums and adapted my internal logic to the information from this forum thread:
Instead of always selecting for OP_WRITE when I want to write, I just try to write. If I was not able to write everything (that is, buffer.remaining () is bigger than 0) I select for OP_WRITE.
This seems to work fine.