• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ping


  • Subject: Re: ping
  • From: Justin Walker <email@hidden>
  • Date: Tue, 10 Feb 2004 15:32:59 -0800

On Tuesday, February 10, 2004, at 02:42 PM, Igor garnov wrote:

[snip]
When I create a socket similar to that shown in "SimplePing" sample, I get a socket that receives all the packet directed to my machine, or only all ICMP packets?

You will only get ICMP packets (as I read the code; the socket is set up for IPPROTO_ICMP, which means "just ICMP").

If I get all the packets - what should I do to prevent other apps from crashing because I intercept packets directed to them?

You won't get all the packets unless you are using a different scheme (libpcap, for example). In any case, you should not have to worry about interfering with other programs' use of the network. The kernel should take care of that (the kernel will give you a copy of the datagram, not "the world's only copy"). If code typified by that in SimplePing causes a problem, there may be a bug in the system, but as far as I know, this is not a problem.

If I have to ping, say, five IPs at a row, is it necessary to create five sockets? Or will it be enough to use just one and to check the source addresses of incoming ICMP packets?

Unless you do something abnormal (like 'connect' to a specific remote site), you will get all incoming packets of the kind you have requested.

Is it the same for endpoints, which I will have to use on Mac OS 9? Will I have to create five endpoints for pinging five IPs, or will one suffice?

Don't know, but I would doubt it. One of the OT experts will have to fill in here.

If for some reason I will go for non-blocking sockets and asynchronous endpoints, is it possible that I lose ICMP echo replies because of delay between actual arrival of data and call of OTRcvUData?

It's possible at any time, independent of blocking status, to lose packets on a datagram socket. The kernel will feel free to dump incoming datagrams if your application is not reading them fast enough. Here, "not fast enough" means either that the system is so loaded that your app doesn't get a chance to run; or that your app is running, but is twiddling its figurative thumbs, off in the weeds somewhere.

Hope that helps.

Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | It's not whether you win or lose...
| It's whether *I* win or lose.
*--------------------------------------*-------------------------------*
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: ping
      • From: Quinn <email@hidden>
References: 
 >ping (From: Igor garnov <email@hidden>)

  • Prev by Date: ping
  • Next by Date: Checking for other copies of my app running on a LAN
  • Previous by thread: ping
  • Next by thread: Re: ping
  • Index(es):
    • Date
    • Thread