title: Error: __tcp_connection_write_eof_block_invoke Write close callback received error - iOS 10
body: <p>While sending XML base API Request to ONVIF Camera. It worked fine on ios 9 device, but giving '500 Internal Error' on iOS 10.</p>
  
  <p>XCode 8 Console prints below error messages:</p>
  
  <pre><code>2016-09-30 12:39:51.295419 VCPlugin[278:10183] [] nw_socket_get_input_frames recvmsg(fd 12, 1024 bytes): [54] Connection reset by peer
  2016-09-30 12:39:51.301221 VCPlugin[278:10228] [] nw_socket_write_close shutdown(12, SHUT_WR): [57] Socket is not connected
  2016-09-30 12:39:51.301307 VCPlugin[278:10228] [] nw_endpoint_flow_service_writes [3 10.107.2.153:80 ready socket-flow (satisfied)] Write request has 0 frame count, 0 byte count
  2016-09-30 12:39:51.301903 VCPlugin[278:10185] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
  2016-09-30 12:41:13.492053 VCPlugin[278:10287] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected
  2016-09-30 12:42:51.278617 VCPlugin[278:10228] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
  </code></pre>
  
  <p>If user retry and retry three-to-four times, then after get valid xml response from server.</p>
  
  <p>I don't know this iOS 10 behaviour.</p>
  
  <p>this is code i have written for call XML API post request:</p>
  
  <pre><code>NSMutableURLRequest * urlRequest = [NSMutableURLRequest requestWithURL:url];
  [urlRequest setHTTPMethod:@"POST"];
  [urlRequest setHTTPBody:body];
  [urlRequest setValue: @"application/soap+xml" forHTTPHeaderField:@"Content-Type"];
  [urlRequest setValue: @"application/soap+xml" forHTTPHeaderField:@"Accept"];
  
  NSURLSessionDataTask * dataTask = [defaultSession dataTaskWithRequest:urlRequest completionHandler:^(NSData *data1, NSURLResponse *response, NSError *error) {
          NSLog(@"Response:%@ %@\n", response, error);
          if(error == nil)
          {
               NSString * text = [[NSString alloc] initWithData: data1 encoding: NSUTF8StringEncoding];
                NSLog(@"Data = %@",text);
          }
  }];
  
  [dataTask resume];
  </code></pre>
  
  <p>Also read <a href="https://forums.developer.apple.com/thread/48959" rel="noreferrer">Apple Form</a>, but not get solution.</p>