Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SocketChannel's SO_RCVBUF fills up and data is lost, need to fix this

801788Apr 6 2012 — edited Apr 7 2012
Lets say I have a ServerSocketChannel on a server that spawns off 30 socketchannels from where clients connections were received. Lets say each socketchannel has a SO_RCVBUF of 5kb. If one of those socketchannels receives 5kb of data before it is able to processes it, will the 29 other socketchannels be able to receive data or do they all share this buffer?

What I am trying to accomplish is a network paradigm where I never loose data. My idea was to, upon establishing a connection, send the other end the size of the SO_RCVBUF, and then make sure I never push out more data than that size. Each time I receive data I will send back an ACK. When this ACK is received I will subtract the size of the packet from the size sent. Basically, this way I will be able to keep track of how much data has been processed on the other end, and make sure that I never send more data than what the other ends SO_RCVBUF can hold. Is this a good strategy? Will this ensure that I am never in danger of loosing data? If there is a better way could you please point me to it?

Thank you for your time,
Brandon
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 5 2012
Added on Apr 6 2012
4 comments
248 views