Re: NSPipe (NSFileHandle) writedata limit?
Re: NSPipe (NSFileHandle) writedata limit?
- Subject: Re: NSPipe (NSFileHandle) writedata limit?
- From: "McLaughlin, Michael P." <email@hidden>
- Date: Fri, 9 Apr 2010 14:55:59 -0400
- Acceptlanguage: en-US
- Thread-topic: NSPipe (NSFileHandle) writedata limit?
I would have bet on #2 as well but everything is typed NSUInteger (same as the docs) and, when I NSLog the relevant sizes, sending and receiving, they all come back as 4 bytes.
I do not know how to "attach" to the producing process. When NSFileHandle writeData takes off, the Xcode debugger goes completely blank (no stack trace or variables).
On 4/9/10 2:25 PM, "Dave Keck" <email@hidden> wrote:
> I am not getting an error; it just hangs.
This is the classic sign that the pipe's buffer is full and that your
consuming process isn't reading the available data from the pipe. If
you attach to the producing process, I would expect its stack trace to
look like:
#0 0x95030c7e in write$UNIX2003
#1 0x93ea84a9 in -[NSConcreteFileHandle writeData:]
...
Is this the case? Assuming it is, perhaps:
1. The value of 'sz' is incorrect at the call to -sendData:?
2. Your consumer is treating 'sz' as the wrong type (likely a short)?
I'd put my money on #2. Treating an NSUInteger with a value of >=
65536 as a short will result in the most significant two bytes being
lost, thus your consumer will be reading very little amounts of data
relative to the available data, and your producer will hang waiting
for the buffer to be cleared.
--
Mike McLaughlin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden