Hello,

On Sun, May 9, 2010 at 4:32 PM, Stéphane Ducasse
<[email protected]> wrote:
>
> On May 9, 2010, at 2:20 PM, Geoffroy Couprie wrote:
>
>> Hello,
>>
>> I try to play with sockets in Pharo, and I encounter a strange error.
>> Here is my code:
>> |tempsock|
>>       Socket initialize.
>>       tempsock := Socket newTCP.
>>       tempsock listenOn: 12345 backlogSize: 4.
>>
>>       [sock isNil] whileTrue:[sock:= tempsock waitForAcceptFor: 600].
>>       sock sendCommand: 'Hello world!!'.
>>       sock ifNotNil:
>>               [[sock isConnected] whileTrue:
>>               [[sock waitForDataUntil:2000] ifTrue:
>>                       [sock sendCommand:'Looping'.
>>                       sock sendCommand: sock receiveData ].
>>       ]].
>>       sock closeAndDestroy.
>
> Now Geoffroy I think that Socket is not "optimal".
>

What should I use then? Is it possible to have non-blocking read on sockets?

>> sock ifNotNil:
>>               [[sock isConnected] whileTrue:
>>               [[sock waitForDataUntil:2000] ifTrue:
>
>                        (sock waitForDataUntil: 2000)?
>

Thank you, it worked :)

Best regards,

Geoffroy

_______________________________________________
Pharo-users mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users

Reply via email to