我試圖發送數據的下一塊之前刷新插座:Node.js:如何刷新套接字?
var net = require('net');
net.createServer(function(socket) {
socket.on('data', function(data) {
console.log(data.toString());
});
}).listen(54358, '127.0.0.1');
var socket = net.createConnection(54358, '127.0.0.1');
socket.setNoDelay(true);
socket.write('mentos');
socket.write('cola');
然而,這也不行,儘管setNoDelay
選項,例如打印「mentoscola」而不是「mentos \ ncola」。我該如何解決?
也許,也許...... – nalply