Re: Network communication with NSFileHandle & NSSocketPort
Re: Network communication with NSFileHandle & NSSocketPort
- Subject: Re: Network communication with NSFileHandle & NSSocketPort
- From: Andrew Farmer <email@hidden>
- Date: Wed, 19 Mar 2008 03:41:52 -0700
On 19 Mar 08, at 02:58, Valentin Dan wrote:
unsigned short serverPort = 9000;
NSString * serverAddress = @“192.1.2.1”;
NSSocketPort * socketPort = [[NSSocketPort alloc]
initRemoteWithTCPPort:serverPort host:serverAddress];
NSSocketPort is part of the Distributed Objects API - despite the
name, it's not a general-purpose socket class. Unless this is
specifically what you're trying to do, you'll need to initialize a
socket FD yourself using BSD calls, then create a NSFileHandle from
that using initWithFileDescriptor:.
There are a couple of alternate approaches. There's CFSocket if you
don't mind working with CoreFoundation. If you want a set of Cocoa
classes, there's NetSocket, among others._______________________________________________
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