• 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: Problems with CFSocket and CFStream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with CFSocket and CFStream


  • Subject: Re: Problems with CFSocket and CFStream
  • From: Jeremy Wyld <email@hidden>
  • Date: Tue, 18 Nov 2003 13:37:11 -0800

On Nov 18, 2003, at 8:24 AM, Martin Bestmann wrote:

1) CFReadStreamCopyProperty(xReadStream,kCFStreamPropertyShouldCloseNative Socket) returns always NULL

kCFStreamPropertyShouldCloseNativeSocket is a "set" property only. Possible oversight on my part?

2) CFReadStreamCopyProperty(xReadStream,kCFStreamPropertySocketRemoteHostN ame) returns always NULL

This property only returns non-null if the stream had been created with a named host. I believe what you want is to copy out the native socket, get its peer address, create a CFHost from that, and then perform the reverse lookup (if you need the name).

3) After closing the streams with CFReadStreamClose and CFWriteStreamClose and also closing the socket with CFSocketInvalidate and quitting app on next launch of the app (within the next few seconds) we get an error when calling CFSocketCreateWithSocketSignature because of the fact that the system for some reason things that the socket is still occupied.


Make sure to
int yes = 1;
setsockopt(<native socket>, SOL_SOCKET, SO_REUSEADDR, (void*)&yes, sizeof(yes));

See Server.c in /Developer/Examples/Networking/Echo/


jeremy
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Problems with CFSocket and CFStream
      • From: Martin Bestmann <email@hidden>
References: 
 >Problems with CFSocket and CFStream (From: Martin Bestmann <email@hidden>)

  • Prev by Date: Problems with CFSocket and CFStream
  • Next by Date: Re: Problems with CFSocket and CFStream
  • Previous by thread: Problems with CFSocket and CFStream
  • Next by thread: Re: Problems with CFSocket and CFStream
  • Index(es):
    • Date
    • Thread