On 17/05/2010 13:44, Mariano Martinez Peck wrote:


On Mon, May 17, 2010 at 2:18 PM, Douglas Brebner <squeaklists@fang.demon.co.uk> wrote:
On 16/05/2010 17:36, RickT wrote:
I still cannot get Socket>>ping: to work; it always times out.

And yes, I meant the OS command window ping worked.  For Windows XP it is
what you would call the DOS command line.  I also downloaded and tried the
Pharo1.0 in my VirtualBox VM running Ubuntu.  I have the same problem:  I
can ping localhost from the Linux command line, but Pharo 1.0 ping always
times out.

(I am running on a Dell M90 Precision laptop. FWIW)

  

The problem is that the Socket>>#ping: does not do the same thing as the command line utilities.

The DOS and Unix ping utilities send an ICMP echo request packet and expects an echo response. This is normally handled by the protocol stack itself.

The Pharo #ping: method makes a TCP connection to port 10 (echo service) on the destination machine. If there's no server listening on that port, the connection will fail.

Thanks for the explanation :)

Now...isn't it 7 by default ?

So you can try the method #pingPortsOn: hostName

which does:

pingPortsOn: hostName
    "Attempt to connect to a set of well-known sockets on the given host, and answer the names of the available ports."
    "Socket pingPortsOn: 'www.disney.com'"

    ^ Socket
        pingPorts: #(7 13 19 21 23 25 80 110 119)
        on: hostName
        timeOutSecs: 20


;)



I believe some intrusion detection software would identify that as a hostile scan looking for vulnerabilities :)

The best thing would be to change #ping: to use ICMP but iirc that requires a raw socket and thus root permission under unix. Alas.