tcp connection problem
Martin Baco
mab at whitestein.com
Mon Aug 14 06:56:19 UTC 2000
Martin Baco wrote:
I experiment with sockets in the Squeak now, but there is a problem
which is very important for me. When I close existing TCP connection on
one side, other side remains still connected. I can send data via
connected socket at the first time without error occurrence. Then some
data are still avialable. I get an empty string when try to read them.
Is it right? How can I detect that other side is disconnected? I also
interested in multicast support in the Squeak. Will it be available in
the near future? Thanks for answer.
"network initialization"
Socket initializeNetwork
ip := NetNameResolver addressForName: 'localhost'.
"connection establishment"
s1 := Socket newTCP.
s2 := Socket newTCP.
s1 listenOn: 12345.
s2 connectTo: ip port: 12345.
"close connection on one side"
s1 close.
s2 sendData: 'some data'. "you can send data"
s2 getData. "you can receive
empty string any times"
s2 getData.
s2 statusString. "socket s2 is
still connected"
I ran this short example in Squeak 2.6 - 2.9alpha with pure images and I
used
free port on my computer.
Jan Barger wrote:
Hmm, sockets are completely asynchronous , try to read more
in sqUnixNetwork.c there will be more uncommon situations if
you will just wait for immediate answer ...
I think your problem is still somewhere else. You want to test
some kind of server or client side of communication and not just
this simple "delay" problem.
Try to put "s1 disconnect" instead of 's1 close'.
Then you will not be able to send more data :)
Or tell me more about your demand for socket communications ...
Michael Rueger wrote:
cite:
I ran this short example in Squeak 2.6 - 2.9alpha with pure images
and I used
free port on my computer.
What platform? Mac, Winxx, Linux?
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) have to change status of the socket on the other
side of the connection ....
Martin Baco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20000814/26e81e2f/attachment.htm
More information about the Squeak-dev
mailing list
|