Re: OT ping sample code
Re: OT ping sample code
- Subject: Re: OT ping sample code
- From: Peter Sichel <email@hidden>
- Date: Mon, 12 Jan 2004 12:15:41 -0500
On Jan 12, 2004, at 11:35 AM, Igor garnov wrote:
On Monday, Jan 12, 2004, at 19:05 Europe/Moscow, Peter Sichel wrote:
Please note - I need a sample code that uses Open Transport. I am
pretty aware that there is a sample at the Apple web site named
"Simple Ping", but it's done using BSD sockets. I would prefer to
avoid digging too deep into that sort of things, although I know
that I will have to unless I have found what I am looking for.
If you want to support machines running Mac OS X outside of Classic
mode,
the Open Transport sample code won't work.
Thus folks like me have had to completely rewrite our software for
Mac OS X.
But what should I do to provide compatibility with both Mac OS 9 and X?
That's a complicated question that depends on what you need to do and
the
importance of Mac OS 9 compatibility. In Mac OS X, Open Transport is a
compatibility layer that sits above BSD Sockets, costs you about 5-10%
in performance, and restricts what you can do.
I thought Open Transport was the right decision, and I still think it
is, but as long as I do not have to ping. Am I right?
As long as you don't need to do anything that requires UNIX privileges.
Looking forward, BSD Sockets is the preferred low level networking API.
For higher level work, consider using the CFNetwork APIs. For Mac OS 9
compatibility, OT is about the only game in town.
In other words, if I do, say, only FTP transfers, can I use OT and
still be sure that my Carbon application works on both Mac OS 9 and X?
Yes unless you want to be an FTP server that listens on a port below
1024.
If I still have to ping hosts - what should I use on Mac OS X instead
of Open Transport? I have already got used to idea of having a
notifier that tells me when something happens on the network. I would
like to use this paradigm further on. If I use BSD sockets, I will
have to implement a kind of a notifier by myself.
What I've done is to implement an ICMP server that notifies any
listeners when
an ICMP message arrives. This is a good design for another reason:
ICMP is
delivered to all listeners which means the kernel would need to wake up
or
schedule every thread that is listening on an ICMP socket. If you have
many
threads that are listening for ICMP, scheduling overhead increases.
I'd rather
notify my various listeners at application time. If you need accurate
timing,
use the so_timestamp option and read the time stamp from the ancilliary
data.
Maybe there is some other way?
Regards,
Igor
Apple chose not to provide a migration path for lower level networking
software.
This is one reason Mac OS X networking utilities have been slower to
appear.
Kind Regards,
- Peter
_______________________________________________
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.