Newbie: Does Socket ping: 'addr' work in Pharo3.11.8 ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Newbie: Does Socket ping: 'addr' work in Pharo3.11.8 ?

Stéphane Ducasse
I would have love to give you a real answer.
I'm doing pharo because I want a beautiful system from which people (and me) can learn.
I want to be enlightened by beautiful code.

Stef

On May 16, 2010, at 8:42 PM, RickT wrote:

>
> I really appreciate the feedback from Stef, Mariano and Ron!
> As a newbie, that is a good "reality check" for me.
> Thanks again guys!
> --
> View this message in context: http://forum.world.st/Newbie-Does-Socket-ping-addr-work-in-Pharo3-11-8-tp2218247p2218774.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie: Does Socket ping: 'addr' work in Pharo3.11.8 ?

Stéphane Ducasse
In reply to this post by Ron Jeffries
Thanks ron for the offer
as you can see in http://code.google.com/p/pharo/issues/detail?id=1884
we got a bit burned by the status of the network code.

So if you can try some expressions with the latest unstable 1.1 it would help us to know
if we should apply the rollback fix.
Lukas sent a call in pharo-dev for testers but probably not in pharo-users.


stef


On May 16, 2010, at 8:46 PM, Ron Jeffries wrote:

> Hello, Stéphane.  On Sunday, May 16, 2010, at 2:35:22 PM, you
> wrote:
>
>>> UseOldNetwork in Pharo1.0, but as you say, it does not exist.  It does in
>>> 1.1 image which is not yet released (I think).
>>>
>>> I think we are stuck with a non-working ping.
>
>> Yes probably.
>
> I looked briefly for other HTTP examples to try. Didn't see any. If
> anyone has something to try, please let me know ...
>
> Ron Jeffries
> www.XProgramming.com
> www.xprogramming.com/blog
> Learn from yesterday, live for today, hope for tomorrow.
> The important thing is to not stop questioning. --Albert Einstein
>
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie: Does Socket ping: 'addr' work in Pharo3.11.8 ?

Douglas Brebner
In reply to this post by RickT
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.

Here's the method comment, emphasis added
"Ping the given host. Useful for checking network connectivity. The host must be running a TCP echo server."

_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie: Does Socket ping: 'addr' work in Pharo3.11.8 ?

Stéphane Ducasse
Thanks douglas.

Stef
On May 17, 2010, at 2:18 PM, Douglas Brebner 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.
>
> Here's the method comment, emphasis added
> "Ping the given host. Useful for checking network connectivity. The host must be running a TCP echo server."
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie: Does Socket ping: 'addr' work in Pharo3.11.8 ?

Mariano Martinez Peck
In reply to this post by Douglas Brebner


On Mon, May 17, 2010 at 2:18 PM, Douglas Brebner <[hidden email]> 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


;)

Mariano

 

Here's the method comment, emphasis added

"Ping the given host. Useful for checking network connectivity. The host must be running a TCP echo server."

_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users



_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie: Does Socket ping: 'addr' work in Pharo3.11.8 ?

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


On Mon, May 17, 2010 at 2:18 PM, Douglas Brebner <[hidden email]> 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.

_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie: Does Socket ping: 'addr' work in Pharo3.11.8 ?

RickT
Thanks for the great response!  I am not only a newbie to Smalltalk but also to any sort of network programming.

I guess my exposure to 'ping' on other systems was always the ICMP flavor; so I was surprised by this implementation.

As Mariano pointed out, the source code in Pharo1.0 indicates port 7:

        tcpPort := 7.  "7 = echo port, 13 = time port, 19 = character generator port"

It seems to me that a ping: method should be the ICMP kind, and a ping:port: method should be for the TCP variety. I presume an echo server could be run on ports other than 7 or 10, depending on preference.  So maybe the port should be designated by the caller, and not hard-coded into the class method.

I see the other reasoning from your response.

Thanks again for clarifying this (and educating me).
12