title: Node.js error ECONNRESET
body: <p>My client (PHP) is repeatedly a message to a Node.js <code>net.Server</code>, and gets an unexpected error.</p>
  
  <p>Part of the server:</p>
  
  <pre><code>socket.on('error',function(err){
      logger.emit('error',err);
  });
  
  [Error: write ECONNABORTED] code: 'ECONNABORTED', errno: 'ECONNABORTED', syscall: 'write'
  
  [Error: read ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' 
  </code></pre>
  
  <p>If I send the messages one by one, I don't get an error.</p>
  
  <p><strong>Edit: posting <code>client.php</code>:</strong></p>
  
  <pre><code>if(isset($_GET['msg'])) {
      $sendmessage = $_GET['msg'];
      $host = "xxx.xxx.xx.xx";//server ip 
      $port = 3030;
  
      $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n");
  
      $errorcode = socket_last_error();
      $errormsg = socket_strerror($errorcode);
  
      socket_set_option($sock, SOL_SOCKET, SO_REUSEADDR, 1);
  
      $result = socket_connect($socket, $host, $port) or die("Couldn't connect to server: [$errorcode] $errormsg");
  
      socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array("sec" =&gt; 60, "usec" =&gt; 0));
  
      socket_write($socket, $message, strlen($message)) or die("Could not send data to server\n");
  
      $serverresponse = socket_read($socket, 1024,PHP_NORMAL_READ) or die("Could not read server response: [$errorcode] $errormsg"); 
  
      echo $serverresponse;
  }
  </code></pre>