Re: AppleTalk to Carbon networking transition advice?
Re: AppleTalk to Carbon networking transition advice?
- Subject: Re: AppleTalk to Carbon networking transition advice?
- From: Frederick Cheung <email@hidden>
- Date: Wed, 1 Feb 2006 21:00:59 +0000
On 1 Feb 2006, at 20:34, David Sinclair wrote:
Hi.
I am upgrading an ancient project that uses AppleTalk networking to
communicate between a server and client applications over a local
area network. I'd like to seek your advice on the best solution.
A bit more info about the situation: There are multiple clients
that connect to the server. The clients mostly send binary
structured (not text) requests to the server and receive binary
structures in return, though sometimes the server initiates a send
to a client. The data transferred is anything from a few bytes to
a megabyte or so -- currently the AppleTalk code splits large
blocks into the smaller packets required by AppleTalk, and caches
and re-assembles them on the other side. There are typically about
3 network requests when opening windows or performing actions on
the client, so a persistent connection may be helpful -- but being
able to recover from disconnections would be nice.
This project is a Classic one being Carbonized (yes, years late!).
We were originally going to upgrade to Open Transport, to maintain
Mac OS 9 compatibility, but are now thinking about dropping that
and using CFNetwork or similar modern API. The apps use Carbon
Events (but presumably I'd be able to call GetCFRunLoopFromEventLoop
() to access the CFRunLoop, if needed).
OpenTransport is going the way of the dodo. I certainly wouldn't get
tied up with that kind of stuff. If you just want to do stuff the to
the runloop for the current thread CFRunloopGetCurrent will do the jom.
Ideally I'd like to use Bonjour, and I currently think that socket
streams would be the best way to transfer the data, but I'd like to
ask you networking experts on the best approach for our needs.
Connecting over a LAN is all that is required, but if connection
over the internet is an option, that would be a nice bonus.
Security is not a big concern at this point, as the data is already
encrypted.
Bonjour is about discovering services on the network, ie finding
addresses. Typically you tell NSNetService or CFNetservice that you
want a certain type of service and it will call your callback when it
finds one. You then ask for it to be resolved and typically you'll
get back IPV6 or IPv4 addresses and port numbers.
However you could of course have obtained that data from elsewhere
(configuration file, the user, etc...), and you could connect to the
machine from anywhere (modulo firewalls, routers etc...). The bonjour
side is also separate from whether you want to use TCP or UDP
Apart from the AppleTalk experience, I've also used NSStream in
Cocoa, and CFStream in Carbon, but I wouldn't call myself an expert
by any stretch, so I'd appreciate any advice you can provide.
I'd say NSStream/CFStream would be a good place to start, i've used
them for similar purposes. CFStreams give you some things pretty much
for free, eg SSL support, SOCKS proxies etc... You also get all the
integration into the runloop.
CFSocket integrates a socket into the runloop, so if you want to use
sockets directly that would probably be your first port of call.
Fred
I was also wondering if there is any suitable sample code available
for Mac OS X server/client networking? I've found a few snippets,
but nothing that really shows server/client communication of the
nature I need.
Thanks!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden