Re: ownership with sendto / CFSocketSendData
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Organization: handmade ! User-agent: MacSOUP/D-2.7 (Mac OS X version 10.4.9) Jens Alfke <jens@mooseyard.com> 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
maclists@batchmaker.de