Receiving arbitrary-sized TCP requests

Chris Muller afunkyobject at yahoo.com
Sun May 16 23:20:12 UTC 2004


Doh!  I think I've fiddled my afternoon away for nothing.  I've been trying to
make my client/server module not depend on a header before now finally
realizing/remembering it is impossible for a TCP server to receive
arbitrary-sized requests without such a header or at least having a delimiter
to look for.

If this is possible, it sure isn't evident to me.  Also, research I've done
suggests it's not possible.

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 client-side
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
joy.

So it's impossible, I guess..



More information about the Squeak-dev mailing list