Re: Sockets documentation?
Re: Sockets documentation?
- Subject: Re: Sockets documentation?
- From: Chris Parker <email@hidden>
- Date: Thu, 14 Feb 2002 10:25:58 -0800
Daniel -
On Wednesday, February 13, 2002, at 01:49 PM, Daniel Byer wrote:
I've been trying to find some documentation on how to use sockets for
TCP/IP and/or UDP, but the only thing I did find had only the methods
listed, not any documentation. Is there somewhere I can find
information on creating/using sockets in Obj-C?
For basic read/write functionality you can create your TCP socket in the
usual BSDish way and then pass that socket on to NSFileHandle.
At that point you'll need to do a few things:
Use connect() to get the socket going.
Add an object as the observer of NSFileHandleReadCompletionNotifications
from your NSFileHandle object. This object will get notifications when
the NSFileHandle has picked up data from the socket - it'll be in the
NSFileHandleNotificationDataItem key in the notification's dictionary.
Use NSFileHandle's readInBackgroundAndNotify on your NSFileHandle
instance.
In your observer's method for the notifications, make sure you renew
your readInBackgroundAndNotify call - it's not set up for you
automatically.
The documentation on NSFileHandle is here:
http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_classic/
Classes/NSFileHandle.html
.chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.