On Sun, Apr 18, 2010 at 1:19 AM, Daniel Birkinshaw < daniel.birkinshaw@googlemail.com> wrote:
On Sat, Apr 17, 2010 at 06:32:22PM +0100, Michael Roberts wrote:
Hi, i think there is something wrong with listenOn:. I am not sure what exactly. the variation below seems to work in Pharo 1.0 on OS X.
| server client | server := Socket new. server listenOn: 12345 backlogSize: 4. server waitForConnectionFor: 600. client := server accept. client receiveData --> 'hello '
and from a shell echo hello | nc localhost 12345
Confirmed, that works for me. I infer from this that it is illegal to call accept with a backlogSize of 0. Perhaps this should be checked for at a higher level so that a meaningful error can be returned?
+1 If you want to can commit a little change for that, I think would be ok. Create an issue in the bugtracker add a unit test if possible!
I was surprised to note that accept returns immediately even if there is no client connected. Try removing the line "server waitForConnectionFor: 600." in your example. The code still runs but the socket it returns is in the connected state even though it can't possibly be connected to anything. Is this behaviour correct? I thought accept was a blocking call.
I'll look into ConnectionQueue, thanks for the help.
_______________________________________________ Pharo-users mailing list Pharo-users@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users