Jan. 15, 2011
12:33 p.m.
Hi all, I'm trying to use the Sockets in Pharo but I don't understand some points. I tried that piece of code: | s c rcv | Socket initializeNetwork. rcv := String new: 400. s := Socket new. s listenOn: 12345. c := s waitForAcceptFor: 30. c dataAvailable ifTrue: [ c receiveDataInto: rcv ] ifFalse: [ self halt ]. waitForAcceptFor: waits a connection, so I opened a telnet client on localhost:12345. It works, but the "accept" primitive always failed. I tried to find some code where it's used: ConnectionQueue>>listenLoop. I assume that method works (but it has no sender), and I don't understand what is different between it and my code. Perhaps I don't try to use the Sockets the good way? Adrien.