On Wed, Mar 19, 2008 at 2:01 PM, Jeff LaMarche <[EMAIL PROTECTED]> wrote:
> > On Mar 19, 2008, at 1:57 PM, Sherm Pendley wrote: > > Hmmm... Actually, now that I'm looking a second time, it looks like you > need to call both socket() to create the socket, then connect() to connect > to a remote host as a client. Then you can use NSFileHandle to do the > reading and writing. > > For a server, you can use socket() to create the socket, then > NSFileHandle's -acceptConnectionInBackgroundAndNotify to accept client > connections. > > It strikes me as kind of odd that NSFileHandle doesn't have an initializer > that wraps the socket() or methods to wrap connect() or listen(), but it > *does* have a wrapper method for accept(). Time to file a feature request, I > think. :-) > > Do you think this would work as an alternative? > > NSSocketPort *port = [[NSSocketPort alloc] initRemoteWithTCPPort:portNum > host:@"theserver.com"]; > int fd = [port socket]; > NSFileHandle *fh = [[NSFileHandle alloc] initWithFileDescriptor:fd]; > Looks reasonable. Now if I could only figure out why I forgot about NSSocketPort... I think maybe I need to write a network app to jog my memory. Obviously I haven't looked at these classes recently enough. :-) sherm-- _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]