• 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: [Q] CoreFoundation functions or Cocoa classes to make a server socket?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] CoreFoundation functions or Cocoa classes to make a server socket?


  • Subject: Re: [Q] CoreFoundation functions or Cocoa classes to make a server socket?
  • From: Quinn <email@hidden>
  • Date: Mon, 2 Feb 2009 10:31:19 +0000

At 14:46 -0800 28/1/09, JongAm Park wrote:
I also noticed NSSocketPort from Cocoa. So, I will figure out how it can be used for my purpose.

Oh boy, don't go there (reading subsequent posts it seems that you didn't go there, which is good :-). But just for the record...


NSPort is part of Distributed Objects. It has two concrete subclasses, NSMachPort and NSSocketPort. The NSPort semantics are very Mach-centric, so NSMachPort is cool and froody but NSSocketPort is a nightmare because Mach message semantics are very different from TCP connection semantics, and trying to make TCP connections look like Mach messaging is... challenging.

Do not use NSSocketPort for anything except DO.

In fact, try to avoid DO-over-TCP if you can. Given the number of DTS incidents that I handle on this topic, and the number of horrible bugs they uncover, it is IMO not worth the cost.

At 11:22 -0700 29/1/09, Scott Ribe wrote:
If so, you could use your current pair of streams. Whenever the client reads
a message from its NSInputStream, that message could be either the response
to its last request, or a notification from the server--you'd just have to
structure your messages such there's info in the header to distinguish the
types of messages.

One gotcha here is that it can involve keeping an inactive TCP connection open to the server for a long time. Most NATs garbage collect inactive connections after a while. So it would behoove you to run the occasional (every ten minutes or so) NOP command over the connection, just to confirm that everything is still in place.


S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Web Services zombie?
  • Next by Date: Re: network traffic statistics
  • Previous by thread: Re: Web Services zombie?
  • Next by thread: OTRcvDisconnect failing with OTResult (-3221)
  • Index(es):
    • Date
    • Thread