Tôi đang cố gắng để tuôn ra một ổ cắm trước khi gửi đoạn tiếp theo của dữ liệu:Node.js: làm thế nào để tuôn ra ổ cắm?
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');
này, tuy nhiên, không hoạt động mặc dù tùy chọn setNoDelay
, ví dụ in "mentoscola" thay vì "mentos \ ncola". Làm thế nào để sửa lỗi này?
có thể, có thể, ... – nalply