On Dec 7, 2012, at 6:25 AM, Kévin Vavelin <vavelinke...@icloud.com> wrote:

> I tried CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, 
> (CFStringRef)@"neventy.fr", 80, &readStream, &writeStream);
> 
> But it seems it doesn't work… I get 4 stream event (1 and 2)

That tells you the input and output streams are opening, and then opened. 
That’s good.

> and after 3 event I get stream event 2 and 4.

Sounds fine. 4 is kCFStreamStatusWriting which tells you you can write to the 
output stream without blocking. Are you writing anything? I don’t know how 
socket.io works, but it’s likely that the server is waiting for you to send it 
something before it will send you a response.

Apple has sample apps that show how to use CFStreams (and NSStreams) for TCP.

BTW, if you prefer using Objective-C you can simply case the CFStreamRefs 
returned by the Create call to NSInputStream* and NSOutputStream*, and then do 
everything else using the NSStream API.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to