• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CFReadStream not giving me any data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFReadStream not giving me any data


  • Subject: Re: CFReadStream not giving me any data
  • From: Jeremy Wyld <email@hidden>
  • Date: Wed, 25 Feb 2004 07:38:35 -0800

CFSocketStream is not guaranteed to work with anything but TCP-based sockets.

Having said that, this should work. Does netstat show bytes waiting in the recv queue on the client? If so, does the stream think it has bytes? Manually poll CFReadStreamHasBytesAvailable to see if it says yes or no. If that fails, perform a select on the socket and see if it succeeds.

I noticed that you are only scheduling the read streams. Is there missing code here or are you using read async and write sync?

jeremy


On Feb 24, 2004, at 11:34 AM, Dave Camp wrote:

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.
_______________________________________________
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.


  • Follow-Ups:
    • Re: CFReadStream not giving me any data
      • From: Dave Camp <email@hidden>
References: 
 >CFReadStream not giving me any data (From: Dave Camp <email@hidden>)

  • Prev by Date: Using Web APIs
  • Next by Date: Re: CFReadStream not giving me any data
  • Previous by thread: CFReadStream not giving me any data
  • Next by thread: Re: CFReadStream not giving me any data
  • Index(es):
    • Date
    • Thread