rsms / peertalk

iOS and Mac Cocoa library for communicating over USB
https://rsms.me/peertalk/
MIT License
3.43k stars 502 forks source link

Opening streams #12

Closed peterpaulis closed 9 years ago

peterpaulis commented 9 years ago

Is there a way to open a NSStream over the connection? This would be much apriechieted

rsms commented 9 years ago

You can use PTUSBHub connectToDevice... and use the dispatch_io_t, which you can probably wrap with a NSStream. AFAIK NSStream is built on top of libdispatch and io channels.

peterpaulis commented 9 years ago

not sure about that, looks like NSStream implements even a lower api than dispatch_io...

peterpaulis commented 9 years ago

ok, did manage to trick it wit this https://github.com/peterpaulis/BufferOutputStreamToInputStream

i 'simulate' an NSStream