Conversion of CFSocketCreateWithNative -> NSSocketPort
Conversion of CFSocketCreateWithNative -> NSSocketPort
- Subject: Conversion of CFSocketCreateWithNative -> NSSocketPort
- From: René v Amerongen <email@hidden>
- Date: Fri, 27 Nov 2009 12:46:15 +0100
Hello,
I' am busy to make an old app up to date and want to use 100% 10.6 cocoa.
I have +75% percent done, but there is something what I can't figure out.
Network calls are now using NSSocketPort, except a few that uses a fileHandle or fileDescriptor to get an IP address, like:
(NSFileHandle *) fh ... is known and come from another class
...
CFSocketRef socket;
socket = CFSocketCreateWithNative (kCFAllocatorDefault, [fh fileDescriptor], kCFSocketNoCallBack, NULL, NULL);
CFDataRef adrData = CFSocketCopyPeerAddress (socket);
struct sockaddr_in *sock = (struct sockaddr_in *)CFDataGetBytePtr(adrData);
NSString *address = [NSString stringWithCString:inet_ntoa(sock->sin_addr)]];
...
How can I get the IP address from a fileHandle using Cocoa?
What is the Cocoa alternative of CFSocketCreateWithNative and CFSocketCopyPeerAddress?
Your help is very appreciated.
Thanks in advance
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden