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

Re: [CFSocket] When should a CFSocketRef be invalidated?


  • Subject: Re: [CFSocket] When should a CFSocketRef be invalidated?
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 12 Jan 2011 12:32:22 -0800

On Jan 12, 2011, at 12:05 PM, Stéphane Sudre wrote:

> 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.

You didn't include a backtrace, but CFSocketIsValid() is a very simple function, and a crash there strongly suggests that you are passing in a pointer that does not point to a CFSocket, and most likely does not point to a readable memory location.

Douglas Davidson

 _______________________________________________
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: Stéphane Sudre <email@hidden>
References: 
 >[CFSocket] When should a CFSocketRef be invalidated? (From: Stéphane Sudre <email@hidden>)

  • Prev by Date: [CFSocket] When should a CFSocketRef be invalidated?
  • Next by Date: Re: [CFSocket] When should a CFSocketRef be invalidated?
  • Previous by thread: [CFSocket] When should a CFSocketRef be invalidated?
  • Next by thread: Re: [CFSocket] When should a CFSocketRef be invalidated?
  • Index(es):
    • Date
    • Thread