CFReadStream not giving me any data
CFReadStream not giving me any data
- Subject: CFReadStream not giving me any data
- From: Dave Camp <email@hidden>
- Date: Tue, 24 Feb 2004 11:34:19 -0800
I'm prototyping some CFStream code that will use unix domain sockets to
communicate between two processes. For testing, I've got a server app
and a client app. The sequence of events looks something like:
- Server creates socket with CFSocketCreateWithSocketSignature
- Client connects with:
CFSocketCreateConnectedToSocketSignature
CFStreamCreatePairWithSocket
CFReadStreamSetClient(
kCFStreamEventOpenCompleted | kCFStreamEventHasBytesAvailable |
kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered)
CFReadStreamScheduleWithRunLoop(readStreamRef, CFRunLoopGetCurrent(),
kCFRunLoopCommonModes);
CFReadStreamOpen
CFWriteStreamOpen
- Server accept callback is called and it does:
CFStreamCreatePairWithSocket
CFReadStreamSetClient(
kCFStreamEventOpenCompleted | kCFStreamEventHasBytesAvailable |
kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered)
CFReadStreamScheduleWithRunLoop(readStreamRef, CFRunLoopGetCurrent(),
kCFRunLoopCommonModes);
CFReadStreamOpen
CFWriteStreamOpen
- Client and Server callbacks are both called with
kCFStreamEventOpenCompleted
- Server writes a string with CFWriteStreamWrite
And that's about where it ends. The client is never called with
kCFStreamEventHasBytesAvailable. At this point, both apps are sitting
idle in their runloops waiting for something to happen. No errors are
detected on any of the calls leading to this point.
If I kill the client, the server gets kCFStreamEventHasBytesAvailable
with zero bytes and kCFStreamEventEndEncountered, as expected. I can
also successfully write from the client to the server. If I kill the
server first, the client does not get any callbacks. It's as if the
pipes are only open one way or something.
Any thoughts on why the client would get a kCFStreamEventOpenCompleted,
but no further messages?
Dave
---
The path of least resistance, it's not just for electricity any more.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.