iphone - NSHost taking an awfully long time -
I have an iPhone app that is a client for an existing server application.
I got the following code to connect, and this code was working fine. Today I have started working on this project, and something strange is happening.
When I click on "Connect", it takes approximately 30-45 seconds for the NSHost to resolve and connect with the host. After the connection is established, the data transfer speed is normal and fast.
I have a basic client software (PC application) connected to the same server, and the connection is handled instantly !!
Perhaps some light can be highlighted on some topic ...
- Try the (IBAction) connection [[auto show legoboards]; IPhone_PNPAppDelegate * mainDelegate = (iPhone_PNPAppDelegate *) [[UIApplication shared application] representative]; Settings = mainDelegate.settings; [Start-up activity]; SendState = 0; NSHOST * Host; // 30-45 The second break occurs here (since I am using an IP address) host = [NSH Host Host: etDard: settings.master location]; // NSHST returns (finally) with the right connection If (host!) {Host = [NSHost hostWithName: settings.masterLocation]; } If (host) {{NSStream getStreamsToHost: host port: [settings.masterPort intValue] inputstream: & amp; IStream Output Stream & amp; Ostream]; If (zero! = IStream & Zero! = Ostream) {[Maintain the ice cream]; [Ostream maintained]; [IStream setDelegate: self]; [Ostream Set Deliaget: Self]; [IStream Schedule Inner Dungeon: [NSRON Loop CurrentArrow Loop] Ford Mode: NSDefaultRane Loop Mode]; [Ostream Schedule Inner: Loop: [NSRON Loop CurrentRun Loop] Format: NSFFFFRRRR Loop MODE]; [IStream Open]; [Ostream open]; } And {[auto reset connection and screen]; Self.navigationItem.prompt = @ "Connection Error! Please check connection settings."; }} And [[auto reset connection and screen]; Self.navigationItem.prompt = @ "Connection Error! Please check connection settings."; }} // I still get these warnings. ** .. wth?! Warning: No '+ hostWithAddress:' method found
I updated my code on the following, which has solved my problem.
- tryConnection {CFReadStreamRef readStream = NULL; CFWriteStreamRef writeStream = NULL; CFStreamCreatePairWithSocketToHost (kCFAllocato RDefault, (CFStringRef) settings.master location, [settings.masterport intValue], read more, and write stream); if (scripts & writestream) {CFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue}; CFWriteStreamSetProperty (writeStream, kCFstreamPropertyShouldCloseNativeSocket, kCFBooleanTrue ); IStream = (NSInputStream *) adstream again; [Made retained]; [IStream setDelegate: self]; [IStream Schedule Inner Dungeon: [NSRON Loop CurrentArrow Loop] Ford Mode: NSDefaultRane Loop Mode]; [IStream Open]; Ostream = (NSOutputstream *) liststream; [Ostream maintained]; [Ostream Set Deliaget: Self]; [Ostream Schedule Inner: Loop: [NSRON Loop CurrentRun Loop] Format: NSFFFFRRRR Loop MODE]; [Ostream open]; } If (ReadStream) CFRighs (ReadStream); If (liststream) CFR (liststream); }
Comments
Post a Comment