Re: [CFSocket] When should a CFSocketRef be invalidated?
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