<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<i><font color="#FF6666">Martin Baco wrote:</font></i><i></i>
<p><i>I&nbsp; experiment with sockets in the Squeak now, but there is a
problem</i>
<br><i>which is very important for me. When I close existing TCP connection
on</i>
<br><i>one side,&nbsp; other side remains still connected. I can send data
via</i>
<br><i>connected socket at the first time without error occurrence. Then
some</i>
<br><i>data are still avialable. I get an empty string when try to read
them.</i>
<br><i>Is it right? How can I detect that other side is disconnected? I
also</i>
<br><i>interested in multicast support in the Squeak. Will it be available
in</i>
<br><i>the near future? Thanks for answer.</i><i></i>
<p><i>"network initialization"</i>
<br><i>Socket initializeNetwork</i>
<br><i>ip&nbsp; := NetNameResolver addressForName: 'localhost'.</i><i></i>
<p><i>"connection establishment"</i>
<br><i>s1 := Socket newTCP.</i>
<br><i>s2 := Socket newTCP.</i>
<br><i>s1 listenOn: 12345.</i>
<br><i>s2 connectTo: ip port: 12345.</i><i></i>
<p><i>"close connection on one side"</i>
<br><i>s1 close.</i><i></i>
<p><i>s2 sendData: 'some data'.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"you can send data"</i>
<br><i>s2 getData.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"you can receive empty string any times"</i>
<br><i>s2 getData.</i><i></i>
<p><i>s2 statusString.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"socket s2 is still connected"</i>
<br><i></i>&nbsp;<i></i>
<p><i>I ran this short example in Squeak 2.6 - 2.9alpha with pure images
and I used</i>
<br><i>free port on my computer.</i>
<br><i></i>&nbsp;<i></i>
<p><i><font color="#FF6666">Jan Barger wrote:</font></i><i></i>
<p><i>Hmm, sockets are completely asynchronous , try to read more</i>
<br><i>in sqUnixNetwork.c there will be more uncommon situations if</i>
<br><i>you will just wait for immediate answer ...</i>
<br><i></i>&nbsp;<i></i>
<p><i>I think your problem is still somewhere else. You want to test</i>
<br><i>some kind of server or client side of communication and not just</i>
<br><i>this simple "delay" problem.</i><i></i>
<p><i>Try to put "s1 disconnect" instead of 's1 close'.</i>
<br><i>&nbsp;</i>
<br><i>Then you will not be able to send more data :)</i><i></i>
<p><i>Or tell me more about your demand for socket communications ...</i><i></i>
<p><i>&nbsp;</i>
<br><i><font color="#FF6666">Michael Rueger wrote:</font></i><i></i>
<p><i>cite:</i>
<br><i>&nbsp;&nbsp;&nbsp;&nbsp; I ran this short example in Squeak 2.6
- 2.9alpha with pure images and I used</i>
<br><i>&nbsp;&nbsp;&nbsp;&nbsp; free port on my computer.</i><i></i>
<p><i>What platform? Mac, Winxx, Linux?</i>
<br><i></i>&nbsp;
<br>&nbsp;
<p>I'm sorry that I'm back with tcp connections :) but I want to complete
my request for you. I used Squeak for Win NT. Jan Barger suggests me to
use disconnect or destroy instead close the socket. Yes, this messages
cause error occurrence when I try to send or receive data after one of
them. But I want to detect that connection is destroyed before I send or
receive some data. I think that disconnect, destroy and possible close
(in reliable network)&nbsp; have to change status of the socket&nbsp; on
the other side of the connection ....
<br>&nbsp;
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Martin Baco</html>