iphone - Socket Timeout - Need Help -


I tried to connect to a server socket, when I enter a non-existent socket server Is using this implementation to connect to? An endless loop, how can i set a timeout

  + (zero) getStreamsToHostNamed: (NSString *) hostname port: (NSInteger) port InputStream: (NSInputStream **) inputStreamPtr outputStream: ( NSOutputStream **) OutputStreamPrint {CFRDstreamRefStream; CFWriteStreamRef WriteStream; By emphasis (hostName! = Zero); Emphasis (port> 0) & amp; amp; (port <65536)); Put emphasis ((inputstreamprint! = Null) || (outputstreamprint! = Null)); ReadStream = NULL; WriteStream = NULL; CFStreamCreatePairWithSocketToHost (Zero, (CFStringRef) hostname, port, ((inputStreamPtr = zero) & readStream:? Zero), ((outputStreamPtr = zero) & writeStream:? Zero)); If (inputstreamprint! = Null) {* inputstreamprint = [nsmkexlabel (ponstream) autorege]; } If (outputstreamPtr! = NULL) {* outputStreamPtr = [nsmkexlabel (liststream) autorege]; }} @end @ Implementation Sockets @ Synthesize iStream; @ Cystiles ostream; @ Synthesis model; - (Zero) Connect: (NSString *) IPAdress and: (NSInteger) Porto {NSString * Temp = [NSString stringWithFormat: @ "% @", IPAdress]; [NSStream getStreamsToHostNamed: Temporary Port: Porto InputStream: & amp; IStream outputStream: & amp; OStream]; [Retained iStream]; [Ostream maintained]; [IStream setDelegate: self]; [Ostream Set Deliaget: Self]; [IStream Schedule Inner Dungeon: [NSRON Loop CurrentArrow Loop] Ford Mode: NSDefaultRane Loop Mode]; [Ostream schedule inneroop loop: [NSRON loop current array loop] Ford modes: NSDFastron Array loop mode]; [IStream Open]; [Ostream open]; NSLog (@ "Konkkkad"); }   

Thanks in advance!

If you want, schedule a timer if the timer NSStreamEventOpenCompleted If you set fire before, you are out of time. Answer as appropriate (turn off currents etc)

Comments