NSHTTPURLResponse statuscode returns 0 . 3 Out of 10 machines returns 0, in the rest


i using snippet data url .


code:
-(int) getdata : (nsstring *) urlstr : (nsdata **) bufferdata {      int retcode =0;      nserror *errorobj = nil;      nshttpurlresponse *httpresponse;      nsdata *buffer;        @try       {               retcode = 0;                 nslog(@"url string:%@\n",urlstr);                 nsurl *urlobj = [nsurl urlwithstring: urlstr];               nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:urlobj cachepolicy:nsurlrequestreloadignoringlocalcachedata timeoutinterval:30.0];                 [request setvalue:@"close" forhttpheaderfield:@"connection"];                 [nsurlrequest setallowsanyhttpscertificate:yes forhost:[urlobj host]];                 buffer = [nsurlconnection sendsynchronousrequest:request returningresponse:&httpresponse error:&errorobj];                 self->httpstatuscode =[b] [httpresponse statuscode];[/b]                 [b]nslog(@"http response status code: %i: description:%@\n",self->httpstatuscode,[nshttpurlresponse localizedstringforstatuscode:self->httpstatuscode]);[/b]                 if(self->httpstatuscode == 200)               {                   *bufferdata = buffer;                   isconnectionsuccess = true;               }               else {                   *bufferdata = nil;                   isconnectionsuccess = false;                   retcode = 1;               }                 //errorobj set if intended response received               if (errorobj)               {                   retcode =  [errorobj code];                   nslog(@"error description: %@\n", [errorobj localizeddescription]);                   isconnectionsuccess = false;               }       }      @catch (nsexception *exp) {      nslog(@"getdata: exception occurred: %@ :reason: %@\n", [exp name],[exp reason]);       retcode = error_failure;       }        return retcode;   }

approximately 3 out of 10 machines fails, in rest 7 machines download goes fine .

getting following error .


code:
http response status code: 0: description:server error error description: not connect server.

ideas ? in advance ...
 

we don't know other 7 machines returning because left in truncated subject line. edit post , describe results there.
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Pasco WA. Cops Killing A Homeless Man while running away

Gold Apple Watch Buyers to Get Special Purchasing Experience With 30 Minute Appointments

Transferring URLS