Re: CFSocket on Windows?
Re: CFSocket on Windows?
- Subject: Re: CFSocket on Windows?
- From: Douglas Davidson <email@hidden>
- Date: Mon, 11 Apr 2005 13:57:45 -0700
On Apr 11, 2005, at 12:00 PM, OL&L Lists wrote: Well, my approach is to define a massive WIn-to-Mac mapping layer that maps all the Windows types to Mac types in which I map SOCKET to CFSocket. I've done huge mapping files like this in the past and they work except that the Windows code has to be conditionalized where calls are made to Windows APIs so that the Mac APIs can be called instead.
I'm porting a pretty huge Windows networking app and there is so much existing networking logic that I thought this would be the best approach. If it doesn't work, I may just have to throw the whole thing out and rewrite it from the ground up.
A closer analog would be to map SOCKETs to BSD sockets. This is the approach that CFSocket itself takes--CFSocketNativeHandle is a wrapper for a SOCKET (on Windows) or a socket file descriptor (on all other platforms). Presumably you are already familiar with BSD sockets, and a BSD socket-based layer would help you to port to other platforms as well.
The point of CFSocket is that it allows a BSD socket to serve as a source for a CoreFoundation-level CFRunLoop. This is an Apple-specific technology, which serves as the basis for the run loop in both Carbon and Cocoa applications; thus CFSocket allows BSD sockets to be integrated gracefully into both Carbon- and Cocoa-based code. If you are not making use of run loops, then there is little point in using CFSocket.
Douglas Davidson
|
_______________________________________________
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