4 Replies Latest reply on Apr 7, 2012 4:10 AM by EJP

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

      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,