Re: Sending ASCII Messages to a TCP Socket
Re: Sending ASCII Messages to a TCP Socket
- Subject: Re: Sending ASCII Messages to a TCP Socket
- From: Chris Hanson <email@hidden>
- Date: Mon, 16 Oct 2006 11:05:50 -0700
On Oct 15, 2006, at 3:08 PM, Ben Barry wrote:
I was just wondering what the easiest way would be to send an ASCII
string to a device that requires a TCP connection would be. I am
fairly new to Cocoa as well as network programming so any advice
would be appreciated.
This should be fairly straightforward with NSStream. Specifically,
check out the documentation for the NSStream class method +[NSStream
getStreamsToHost:port:inputStream:outputStream:]. Given an NSHost and
a port, it can return an open NSInputStream and NSOutputStream that
you can use to communicate with it.
Don't bother looking at NSPort and NSSocketPort for this; those
classes are for use with Distributed Objects, not for implementing
generic networking protocol support.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden