• 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
[CFSocket] When should a CFSocketRef be invalidated?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CFSocket] When should a CFSocketRef be invalidated?


  • Subject: [CFSocket] When should a CFSocketRef be invalidated?
  • From: Stéphane Sudre <email@hidden>
  • Date: Wed, 12 Jan 2011 21:05:16 +0100

Stupid question:
----------------

When should a CFSocketRef be invalidated in a network client application?


----------

I have a process that uses CFSocketRef to connect to a TCP server and get some data.

I'm using a run loop source and connect and data callbacks.

When I receive the final kCFSocketDataCallBack with a zero data length, I invalidate the CFSocketRef.

In one case, it works.

In the other, it does not (it crashes).

Calling CFSocketIsValid before calling CFSocketInvalidate just makes the code crash in CFSocketIsValid instead.

The connection is closed by the server in both cases after the server provided the requested data.



The documentation did not help. The sample code did not help (most of the sample code referenced by the documentation don't really use CFSocketRef strangely or at least not with the callback mechanism for a client).


_______________________________________________ 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
  • Follow-Ups:
    • Re: [CFSocket] When should a CFSocketRef be invalidated?
      • From: "Quinn \"The Eskimo!\"" <email@hidden>
    • Re: [CFSocket] When should a CFSocketRef be invalidated?
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: Initiating racoon/IPSec VPN connection via command line
  • Next by Date: Re: [CFSocket] When should a CFSocketRef be invalidated?
  • Previous by thread: Re: The possible reasons for SOCK_DGRAM packet loss in PF_LOCAL domain
  • Next by thread: Re: [CFSocket] When should a CFSocketRef be invalidated?
  • Index(es):
    • Date
    • Thread