I am trying to connect from an iphone app to a java server but i got stuck pretty quickly as the documentation for NSStream does not seem to match my results.
Documentation
states that after calling the function
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)[website host], 80, &readStream, &writeStream);
Either readStream or writeStream will be NULL if connection failed. But they are never NULL even if i disconnect from internet.
So what i am wondering is what i could be doing wrong or if there is a better way to do this.
thanks!
Which documentation are you reading? The CFStream documentation makes no mention of returning NULL read and write streams. In fact, it states that the connection is not actually attempted until you try to open one of the returned streams.