Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Does Net::Ping have concurrency issues?

by isotope (Deacon)
on May 30, 2003 at 18:05 UTC ( [id://261910]=note: print w/replies, xml ) Need Help??


in reply to Does Net::Ping have concurrency issues?

Ok, duh, moved Net::Ping->new() to within the child block so each child instantiates its own $pinger. Now it works. I guess Net::Ping tracks the responses by PID.

Update: Ok, brain fart... You're right, Thelonius, it's using one socket per instantiation instead of creating a new one for each ping. I'll blame my allergy attack.

--isotope
  • Comment on Re: Does Net::Ping have concurrency issues?

Replies are listed 'Best First'.
Re: Re: Does Net::Ping have concurrency issues?
by Thelonius (Priest) on May 30, 2003 at 18:17 UTC
    I guess Net::Ping tracks the responses by PID.
    No, not exactly. Net::Ping opens a socket, which is like a file descriptor. The socket is bound to a given port in the chosen protocol. When you fork, the socket (like any file descriptor) is shared by the children. When a ping response comes back, the operating system network driver looks at the port number in the packet to determine where to put the data. All your processes are trying to read the same port, but only one is going to get it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://261910]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-18 17:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found