• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sending ASCII Messages to a TCP Socket
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Sending ASCII Messages to a TCP Socket (From: Ben Barry <email@hidden>)

  • Prev by Date: Re: Sending ASCII Messages to a TCP Socket
  • Next by Date: Re: Sending ASCII Messages to a TCP Socket
  • Previous by thread: Re: Sending ASCII Messages to a TCP Socket
  • Next by thread: WebView keyboard events
  • Index(es):
    • Date
    • Thread