• 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: OT ping sample code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT ping sample code


  • Subject: Re: OT ping sample code
  • From: Igor garnov <email@hidden>
  • Date: Tue, 13 Jan 2004 10:40:31 +0300

Hi Andy

I have an implementation of ping that does the OS9 stuff under OS9 (as per
sample from Apples web site), and under OSX 'simulates' ping by attempting
to connect to ports 9 (discard port) and then 21 (ftp port). I further test
the error code I get back, if the connect fails. If a machine refuses
connections on those ports, but does exist, it appears that I get an error
"kOTCanceledErr" back, whereas if the machine doesn't exist, then I get a
different error.

Is this true for any port?

Let me think aloud for awhile, and please correct me if I am wrong.

When I try to establish connection to a remote host, I use TCP over IP.
TCP is just a mechanism that ensures that all my packets reach their destination or informs me if it is absolutely impossible to deliver any of them.
Beneath TCP, we have IP. It knows nothing about ports. Its task is to deliver data between machines on the network. It counts on TCP in aspect of determining to which application this or that packet should be delivered.

So, this lets me believe that there MIGHT be different types of errors depending on the situation.
If the host is offline, it is IP that reports the error, because it is IP that cannot deliver data.
But if the host is online but is not listening to the port I am trying to connect to, IP delivers data to the remote machine and gives it to TCP (there is no error from the IP's point of view). And after that TCP sees that there is no application that has opened the port specified in the freshly received packet. and rejects it. Then it reports the error, but this error should probably be different from that the IP returns.

Am I right?

I'm not saying this is 'best practise', but the combination of all of this
seems to work and I've used it for quite a while now. I'm not sure how this
will work across the internet, but then my ping only needs to work on an
intranet (so I don't care).

That's exactly what I need! I am interested in intranet, too.
That 'discard port' - I have seen it on the list off well known ports, but never knew what it does.

Hope that helps.

That does help, thanks!

Regards,

Igor
_______________________________________________
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: OT ping sample code
      • From: Justin Walker <email@hidden>
    • Re: OT ping sample code
      • From: "Andy Cave" <email@hidden>
References: 
 >Re: OT ping sample code (From: "Andy Cave" <email@hidden>)

  • Prev by Date: Re: OT ping sample code
  • Next by Date: Re: OT ping sample code
  • Previous by thread: Re: OT ping sample code
  • Next by thread: Re: OT ping sample code
  • Index(es):
    • Date
    • Thread