Socket class>>#ping does not do an ICMP ping at all, I doubt there is even a primitive to do that. Socket does do only UDP/TCP sockets. I always thought that ICMP pings are not 'normal' UDP packets, but I could be wrong. If you know that the other end is an HTTP server, a HEAD request could be useful. I guess that what you mean by slow is that the timeouts are too high for a quick negative answer. There is ZnClinetTests>>#testIfFailNonExistingHost that fails pretty quickly, but that is for a non-existing DNS lookup. An actual connect does currently not honor the ZnClient>>#timeout: setting, that should be fixed, then you should be able to do ZnClient new beOneShot; timeout: 0; head: 'http://zn.stfx.eu'. I'll put it on my list. On 17 Sep 2012, at 17:44, Bernat Romagosa <tibabenfortlapalanca@gmail.com> wrote:
Hi list,
How does one ping a host from Pharo? I see there is a #ping: method at Socket class, but it's painfully slow... I've tried to use ZnClient as follows:
isUp := [ (ZnClient new head: aUrl) isNil ] on: Error do: [ false ].
But it's still way too slow... I don't want to perform a full GET request, just an ICMP one.
Thanks!
Bernat.
-- Bernat Romagosa.
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill