Re: Create a socket.io connection to node.js server
Re: Create a socket.io connection to node.js server
- Subject: Re: Create a socket.io connection to node.js server
- From: Jens Alfke <email@hidden>
- Date: Fri, 07 Dec 2012 10:30:50 -0800
On Dec 7, 2012, at 6:25 AM, Kévin Vavelin <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden