Re: ownership with sendto / CFSocketSendData
Re: ownership with sendto / CFSocketSendData
- Subject: Re: ownership with sendto / CFSocketSendData
- From: email@hidden (Hado Hein)
- Date: Thu, 25 Feb 2010 10:58:37 +0100
- Organization: handmade !
Jens Alfke <email@hidden> wrote:
> On Feb 24, 2010, at 6:15 AM, Hado Hein wrote:
> > If it is not released it should be valid on my next send-cycle. So I'd
> > reuse it, the pointed to data is read again (it mitght have changed in
> > the meantime) and sended out. This is what I'd expect.
>
> This wouldn't work if CFSocketSendData retains the CFDataRef and accesses
> it later (i.e. if it has to queue it because the socket's write buffer is
> full.) In that case you might be overwriting bytes that it hasn't sent
> yet, causing the wrong data to be sent. It would be safer to use a new
> CFData object every time.
I do not read that. The Call to CFSocketSendData is not async. Then it
would have some completition call back. As far as I understood it, also
sendto returns when it is done.
In that case (with a ...NoCopyData-Ref) it seems ok for me to change the
buffer contents outside the call to sendData.
I'll try it out if it works and let you know. Basically I'm doing this
cause in the iP-OS the doc say that sendto is available but CFSocket
should be preferred. So I just want to support the runloop concept at
that point (cause the processing power is limited on that platform).
--
Hado Hein (KSK, DTHG), master craftsman of stagecrafts, Berlin
followme office +49.30.91688488
www.beleuchtungsbildner.de - Stage Lighting Directing
www.batchmaker.de - Stage Lighting Design, Control and Routing
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden