why there is a difference between first and second socket request in my nodejs code?
<p>Here is my echo server code</p>

<pre><code>var net = require('net')                                                           

var server = net.createServer(function(socket) {
    socket.write('Echo server\r\n');
    socket.on('data', function(data) {
        console.log('recv data: ' + data);
        socket.write(data + ' random data');
    }); 
    socket.on('end', socket.end);
});

server.listen(1337, '127.0.0.1');
</code></pre>

<p>This is the test code</p>

<pre><code>var net = require('net');                                                          

var client = new net.Socket();

client.connect(1337, '127.0.0.1', function() {
    console.log('Connected');
    client.write('Hello, server! Love, Client.');
});

client.on('data', function(data) {
    console.log('Received: ' + data);
    client.destroy();
});

client.on('close', function() {
    console.log('Connection closed');    
});
</code></pre>

<p>When I first run the client after the server starts, terminal show:</p>

<pre><code>➜  test node client.js 
Connected
Received: Echo server

Connection closed
</code></pre>

<p>I can see the server has send the data to client in wireshark,but client send a RST packet to server immediately after this packet.</p>

<p>the second is normal</p>

<pre><code>➜  test node client.js
Connected
Received: Echo server
Hello, server! Love, Client. random data
Connection closed
</code></pre>