help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help on sending a UDP Packet


From: address@hidden
Subject: Re: Help on sending a UDP Packet
Date: Tue, 12 Jan 2021 19:50:40 +0100 (CET)

Gary,

I cannot tell whether GNU smalltalk is stable or not,
only whether the simple datagram daytime test works for me ...

Also it may be that GNU smalltalk has different strengths than socket 
programming,
the fact that they have on the roadmap for GNU smalltalk 3.3 a 'complete 
rewrite'
of the socket code, worries me to say the least ...

When I modify the script that I posted to use a different host, it works for me:

First I test from a different host a connection to host 'antar' :

bash-4.4$ nc -u antar 13
123
Tue Jan 12 19:41:27 2021
^C

Then when I do the same thing with GNU smalltalk 3.2.5 from the remote host it 
works:

bash-4.4$ cat daytime-dgram.st 
PackageLoader fileInPackage: 'Sockets'.

h _ Sockets.SocketAddress byName:'antar'.
h printNl.
s _ Sockets.DatagramSocket new.
d _ Sockets.Datagram data:#'hello world' address:h port:13.
answer _ Sockets.Datagram new.
s nextPut:d.
s receive:answer.
(answer data) asString printNl.
s close.

bash-4.4$ gst daytime-dgram.st 
Loading package ObjectDumper
Loading package Sockets
192.168.0.2
'Tue Jan 12 19:46:56 2021
'

This is of course assuming that 'antar' returns the dgram daytime service.

But that in itself is a classical simple test for datagrams.

Regards,
David Stes

----- Op 12 jan 2021 om 17:28 schreef Gary Highberger gary.highberger@gmail.com:

> Hi David and everybody,
> 
> I just sent my first UDP packet with Smalltalk Sockets. It's likely just me
> but there might be some instability in gst. Somehow my Datagram Socket got
> wiped out. I'm going to run tests and publish my findings here.
> 
> Have GNU Smalltalk Sockets and the VM been proven in real world
> applications?
> 
> Packet:
> $ sudo tcpdump -i 1 -nn -n -A port 49152
> tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
> listening on wlp3s0, link-type EN10MB (Ethernet), capture size 262144 bytes
> 10:53:15.131345 IP 192.168.1.114.49153 > 192.168.1.249.49152: UDP, length 27
> E..7..@.@..0...r.........#..  Hi sailor! New in town?
> 
> Smalltalk:
> st> PackageLoader fileInPackage: 'Sockets'
> "Global garbage collection... done"
> Loading package Sockets
> PackageLoader
> st> DgS := Sockets.DatagramSocket remote: '192.168.1.249' port: 49152
> local: '192.168.1.114' port: 49153
> Sockets.DatagramSocket[192.168.1.114:49153]
> st> DgD := Sockets.Datagram data: '  Hi sailor! New in town?  '
> a Datagram
> st> DgS nextPut: DgD
> Sockets.DatagramSocket[192.168.1.114:49153]
> Voila
> 
> Many thanks for the help everybody!
> 
> Gary
> 
> On Sun, Jan 10, 2021 at 1:49 PM Gary Highberger <gary.highberger@gmail.com>
> wrote:
> 
>> Hello David and all,
>>
>> I have a few (noob) questions about the UDP example Smalltalk program.
>> More questions likely to follow as I come up to speed. Your patience is
>> much appreciated David and everybody.
>>
>> QUESTIONS:
>> •  Is "_" the preferred assignment operator? I've been seeing ":=" too. I
>> don't have a back arrow on my keyboard. I guess the PARC people used "_".
>>
>> •  Does statement 1)
>> assign the destination IP address? Note that for my application, the
>> source and destination addresses will be different.
>>
>> •  Does statement 3)
>> populate the (UDP) datagram socket with the message, port, and address?
>> Why a "#" symbol prefixing the message string, 'hello world'?
>>
>> •  Does statement 4)
>> create a listening socket?
>>
>> •  Does statement 5)
>> trigger the send?
>>
>> •  Does statement 6)
>> block until the UDP response?
>>
>> +---------------------------------------------------------+
>>
>> UDP Smalltalk (example) program:
>>
>> 1) h _ Sockets.SocketAddress createLoopbackHost.
>>
>> 2) s _ Sockets.DatagramSocket new.
>>
>> 3) d _ Sockets.Datagram data:#'hello world' address:h port:13.
>>
>> 4) answer _ Sockets.Datagram new.
>>
>> 5) s nextPut:d.
>>
>> 6) s receive:answer.
>>
>> 7) (answer data) asString printNl.
>>
>> 8) s close.
>>
>> Gary Highberger
>>
>>
>> On Sun, Jan 10, 2021, 8:48 AM Gary Highberger <gary.highberger@gmail.com>
>> wrote:
>>
>>> Good morning David,
>>>
>>> I'm not familiar with 'daytime' but will come up to speed on it and get
>>> it and your use cases running and report my findings for everybody to see.
>>>
>>> Hopefully netTest.c explains what I'm trying to do with Smalltalk. It's
>>> very short and simple.
>>>
>>> https://www.dropbox.com/s/xc23wj6r5aqh153/netTest.c?dl=0
>>>
>>> I used my cell phone as the destination, my home WiFi as the network, and
>>> tcpdump to see the packet.
>>>
>>> Thank you David for the Smalltalk code fragments and introducing me to
>>> inetd and 'daytime'.
>>>
>>> Gary Highberger
>>>
>>>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]