• Advertisement

Archived

This topic is now archived and is closed to further replies.

java.nio - Do I need to worry about slow connections?

This topic is 5037 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m working on a server (yeah, sure like everyone else). Anyway, I have requests gathering with a non-blocking server using select(). Not getting into details, these requests are then processed in a single thread. Any outgoing messages are sent to be dispatched elsewhere by another thread. First of all, I wonder if I really need a different thread for the outgoing messages. This all boils down to the question how java.nio.channels.SocketChannel''s write(ByteBuffer) actually works. To make sure everything is sent I "while(whilelefttosend>0)" wrap the write to make sure the whole package gets completed. Anyway, if the speed or bytes-written-per-write is dependent on the speed of the connection I write to I''m in trouble. I''m kind of hoping that you send by write and then it gets put in some queue in the os waiting for dispatch. That''s the way I want it to work. Now if this ISN''T the way it works I need to make a thread architecture to make it work like that, which is well... a little more messy.

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement