Receiving arbitrary-sized TCP requests
peter at ozzard.org
Sun May 16 23:33:02 UTC 2004
> From: [...] Chris Muller
> The problem is, very simply, when the server is receiving the
> request, it has
> no reliable way of knowing when it's received it all.
> receiveSomeData: doesn't
> get it all, and dataAvailable can return false if the client is
> sending slowly,
> but not necessarily done sending it all yet.
> It sure is amazing to me that there is no built-in flow-control
> mechanism for
> TCP for this. I briefly hoped that #close after #sendDone on the
> would allow a check for #isOtherEndClosed in the server to
> determine it was
> done. Unfortunately, that then disallows data-flow in both
> directions so no
> So it's impossible, I guess..
Half-close should work (a la RSH), but it's possible that Squeak doesn't
allow that. What happens if you just use #sendDone? I suspect close will
close the association with the socket, whereas you simply want the client to
send a FIN.
Half-close is one of TCP's mechanisms for this. The other would be to send
out-of-band data as the delimiter, but there is no guarantee that the
receiver will receive the out-of-band data interleaved with your data in the
same way in which you sent it - in fact, it's almost guaranteed not to if I
More information about the Squeak-dev