question about UDP socket

danil a. osipchuk danil-home at tsnet.ru
Tue Oct 12 16:06:00 UTC 2004


Thank you, Ned
With your code I still getting "primitive failed' - this time at  
#primSocket: receiveUDPDataInto: startingAt: count:
What vm you are using?

>On Tuesday 12 October 2004 5:35 am, danil a. osipchuk wrote:
>  
>
>>Hi, all
>>Can somebody give me a hint why this doesn't work(unix vm 3.6-3, FreeBSD)?:
>>
>>dst _ Socket newUDP setPort: 55555.
>>src _ Socket newUDP.
>>src sendUDPData: 'a test' toHost:  (NetNameResolver localHostAddress)
>>port:  dst port. " *primitive failed* here "
>>src closeAndDestroy.
>>buff _ Array new: 100.
>>dst receiveUDPDataInto: buff.
>>buff inspect.
>>dst closeAndDestroy.
>>    
>>
>
>
>This works for me:
>
>dst _ Socket newUDP setPort: 55555.
>src _ Socket newUDP.
>buff _ ByteArray new: 100.
>delay _ Delay forMilliseconds: 100.
>localhost _ ByteArray withAll: { 127. 0. 0. 1 }.
>received := nil.
>
>rp := [[ received := dst receiveUDPDataInto: buff.
> received first  isZero ] whileTrue: [ delay wait ].
> WorldState addDeferredUIMessage: [ { buff. received } inspect ]] fork.
>
>src sendUDPData: 'a test' toHost: localhost port:  dst port.
>
>src closeAndDestroy.
>dst closeAndDestroy.
>
>  
>




More information about the Squeak-dev mailing list