I was trying to get some insight into my problems with the RFB/VNC performance and tried the purportedly trivial `Socket ping: 'gravious.local'`
It doesn't work from Squeak. It does from a shell, or indeed from the OSProcess sub task. 'Gravious.local' is the bonjour name for my local X64 xubuntu box. The result is an immediate error because the apparent problem is that attempting to connect the socket to the (correctly resolved) IP leaves the socket status as 0/Unconnected. This actually makes the ping: code drop straight out and run the refusedBlock in Socket>>#waitForConnectionFor:ifTimedOut:ifRefused:
If I try 'google.com' (you might have heard of them?) it doesn't do this but instead simply times out after 10 seconds. If I try using the IP address instead of the name, it makes no apparent difference, not even for the same machine/localhost.
I tried out Socket class>>#pingPorts:on:timeOutSecs: for fun, since it tries a list of normally accessible ports. No luck there either.
I've tried from ARM 64bit linux, X64 linux, Mac OS - can't try from Windows. What on earth?
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Fractured Idiom:- RIGOR MORRIS - The cat is dead
Hi,
Ah, it is because the method is very badly named. The comment is right though.
ping: hostName
"Ping the given host. Useful for checking network connectivity. The host must be running a TCP echo server."
"Socket ping: 'squeak.cs.uiuc.edu'"
| tcpPort sock serverAddr startTime echoTime |
tcpPort := 7. "7 = echo port, 13 = time port, 19 = character generator port"
serverAddr := NetNameResolver addressForName: hostName timeout: 10.
serverAddr ifNil: [ ^self inform: 'Could not find an address for ', hostName ].
sock := Socket new.
sock connectNonBlockingTo: serverAddr port: tcpPort.
It says "ping" but it really is a test your TCP echo server which you are unlikely to be running. Probably should be renamed EchoClient or some such thing.
The echo server on linux would normally have been started via inetd or xinetd. In general those are no longer installed on modern systems.
It works correctly if you can find a server running the echo service. NB: This IP address is not visible outside of our network.
Ping sends ICMP packets. There is a python example here.
sockets - How to create an ICMP traceroute in Python - Stack Overflow [https://stackoverflow.com/questions/10256560/how-to-create-an-icmp-tracerout...]
If someone feels wildly motivated they could update the ping method to do a real ping. I might play with this as well but no promises.
cheers
bruce
On 2023-07-05T05:22:49.000+02:00, Tim Rowledge tim@rowledge.org wrote:
I was trying to get some insight into my problems with the RFB/VNC performance and tried the purportedly trivial `Socket ping: 'gravious.local'` It doesn't work from Squeak. It does from a shell, or indeed from the OSProcess sub task. 'Gravious.local' is the bonjour name for my local X64 xubuntu box. The result is an immediate error because the apparent problem is that attempting to connect the socket to the (correctly resolved) IP leaves the socket status as 0/Unconnected. This actually makes the ping: code drop straight out and run the refusedBlock in Socket>>#waitForConnectionFor:ifTimedOut:ifRefused: If I try 'google.com [http://google.com%5D%27%C2%A0(you%C2%A0might%C2%A0have%C2%A0heard%C2%A0of%C2.... If I try using the IP address instead of the name, it makes no apparent difference, not even for the same machine/localhost. I tried out Socket class>>#pingPorts:on:timeOutSecs: for fun, since it tries a list of normally accessible ports. No luck there either. I've tried from ARM 64bit linux, X64 linux, Mac OS - can't try from Windows. What on earth? tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Fractured Idiom:- RIGOR MORRIS - The cat is dead
Following from Bruce's advice I was able to find out that using `ncat` can provide simple test implementations of services for the #ping:, #timeTest, #timeTestUDP, and #sendTest methods.
A couple of updates are in the inbox right now with extended commentary including examples of how to use the ncat fragments. If it is possible to have the relevant services run on squeak.org for testing it might be nice.
The advice on ncat was found at https://nmap.org/ncat/guide/ncat-simple-services.html
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim this blank intentionally left spaced
squeak-dev@lists.squeakfoundation.org