[Newbies] sockets in threads

Aidan Gauland wgsilkie at ihug.co.nz
Sat Sep 27 04:14:06 UTC 2008


Hello,

  I have successfully followed this tutorial on the Squeak wiki, 
http://wiki.squeak.org/squeak/325 so I tried to come up with a way to have a 
socket listening on its own thread.  This is what I came up with (in a 
Workspace)...

[sckt := Socket newTCP listenOn: 8080.
[sckt isConnected & sckt dataAvailable
ifTrue: [Transcript cr; show: (sckt receiveData)].
(Delay forSeconds: 1.5) wait] repeat] fork.

But when I open an inspector on a new socket, and use it to connect to the 
socket on the thread, it doesn't work.  Here's what happens...
  -The socket used to connect says it's connected.
  -sckt says something like "other end closed, but not this end".
  -And nothing shows up on the Transcript when I sendData: on the connecting 
socket.

I can't figure out what the problem is.  Any ideas, anyone?

Thanks,
Aidan



More information about the Beginners mailing list