> > Well, lets say you have a situation where you're going to be
> > alternating between sending large and small chunks of data. Is the
> > solution to create a NetworkBuffer class and only call send when the
> > buffer is full, always recv(8192)?
>
>         Or create a protocol where the first 16 bits (in network byte order)
> contain a length value for the subsequent data, and use a receive
> process that consists of:
>
> leng = ntoh(socket.recv(2))
> data = socket.receive(leng)
>
> (the send can combine the length with the data into a single packet)

Are two 'sends' guaranteed to arrive as at least two 'receives'?

Send-3:  xxx
Send-3:  yyy
Receive-6:  xxxyyy

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to