0

How do i create a NSStream from a dispatch_io_t?

/*!
 * @typedef dispatch_io_t
 * A dispatch I/O channel represents the asynchronous I/O policy applied to a
 * file descriptor. I/O channels are first class dispatch objects and may be
 * retained and released, suspended and resumed, etc.
 */
DISPATCH_DECL(dispatch_io);
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
  • What are you really trying to do here? There's not a general "conversion" between these two things, so any solution will depend on the situation/context. – ipmcc Feb 02 '15 at 23:06
  • I need to use https://github.com/rsms/peertalk with NSStream, to stream data files over the connection, unfortunately, the lib uses dispatch_io_t – Peter Lapisu Feb 03 '15 at 09:19
  • I'm new to peertalk, but is there a reason you wouldn't just have your `PTChannelDelegate` handle it? i.e. receive data from the `PTChannel`, re-transmit the data to the `NSStream`, and vice versa? AFAICT, you should be able to do this without ever needing to touch the underlying `dispatch_io_t`. For instance, neither the iOS nor the OS X sides of the peertalk example apps ever touch a `dispatch_io_t`. – ipmcc Feb 03 '15 at 12:30
  • i created a new issue for that http://stackoverflow.com/questions/28306611/simulate-nsinputstream-with-data-exchange – Peter Lapisu Feb 03 '15 at 18:55

0 Answers0