Re: TCP/IP Connections
Re: TCP/IP Connections
- Subject: Re: TCP/IP Connections
- From: Chris Parker <email@hidden>
- Date: Sat, 22 Dec 2001 23:45:00 -0800
Hi Sander,
On Saturday, December 22, 2001, at 07:00 AM, email@hidden wrote:
* Bugger all and write my own classes using the BSD layer
I hope it won't have to come to that, but I could also write my own
classes (much the way OMNI did) using POSIX and make it asynchronous by
using an NSTimer.
* Any other???
You may wish to look at NSFileHandle. Although you'd have to create the
network socket in the traditional manner, you can create an NSFileHandle
from the file descriptor resulting from that by using
initWithFileDescriptor:closeOnDealloc:
Once you've got that set up you can add another object as an observer of
the NSFileHandleReadCompletionNotification which will tell you when you
get data on the socket.
Once you've got that set up, you can use readInBackgroundAndNotify: in
order to have it read in the background and issue the notification above.
.chris
--
Chris Parker
Cocoa Frameworks Engineer
Apple Computer, Inc.