2
我已經寫了這個代碼發送數據包到套接字並從中讀取。但是當我運行它,我從套接字獲取數據,但代碼拋出錯誤說閱讀ECONNRESET。我做錯了什麼?Nodejs套接字連接錯誤
var client = net.connect({port:remotePort, host:remoteIpAddress},function(){
client.write(packet);
});
client.on('data',function(chunkData){
console.log(chunkData);
client.end();
});
client.on('end',function(){
console.log("Reading end");
});
client.on('error', function(err){
console.log("Error: "+err.message);
})