question about UDP socket

danil a. osipchuk danil-home at tsnet.ru
Wed Oct 13 17:44:50 UTC 2004



Thanks Ned & Jan, finally I've got it (really subtle matter). The 
simplest form working for me:

dst _ Socket newUDP setPort: 55555.
src _ Socket newUDP.
src sendUDPData: 'a test' toHost:  (ByteArray withAll: {127. 0. 0. 1.})  
port:  dst port.
buff _ ByteArray new: 100.
dst receiveUDPDataInto: buff.
buff inspect.
dst closeAndDestroy.
src closeAndDestroy.
src := dst := nil.

My mistakes: NetNameResolver localhost gave me 192.168.20.21 (thanks Ned 
) and wrong array type (thanks Jan). Latest Ned's example works also. I 
wonder a bit - why UDP send fails (it should not I think),  but anyway - 
it works in some way



More information about the Squeak-dev mailing list