SocketStream>>flush question

Craig Latta craig at netjam.org
Mon Mar 8 20:01:32 UTC 2004


	David Shaffer writes:

> Yes, the sockets API gives me a clear cut way to determine if a
> connection was closed on the other end.

	Lex responds:

> I am sure it does but I don't know that it is simple.  read() can
> also return 0 if there is simply no more data available and you have
> the socket in non-blocking mode.

	This is one reason why Flow uses blocking sockets in host threads.
Getting zero from read() in that configuration means that the peer has
closed.

	For writing, one must indeed just make the writing attempt, and deal
with any errors that result (and many are possible :). The error
information returned, if an error occurs, is not ambiguous.


-C

--
Craig Latta
improvisational musical informaticist
craig at netjam.org
www.netjam.org
[|] Proceed for Truth!




More information about the Squeak-dev mailing list