I have an Socket in node.js. I send 3 different data to my server. But my 2 and 3 datas are going together to server.
My Socket server code is:
var net = require("net");
const server = new net.Server()
server.on("connection", (client) => {
client.on("data", (data) => {
console.log(data)
})
})
server.listen(5000)
My Socket client code is:
var net = require("net");
const client = new net.Socket()
client.connect({ host: "localhost", port: 5000 }, () => {
console.log("Client Connected !");
client.write(Buffer.from([0x82, 0x80, 0x09, 0xf6, 0x9f, 0x00, 0x04, 0x73, 0x65, 0x66, 0x61, 0x00]))
client.write(Buffer.from([0x30, 0x08, 0x00, 0x04, 0x73, 0x65, 0x66, 0x61, 0x61, 0x73]))
client.write(Buffer.from([0x30, 0x08, 0x00, 0x04, 0x73, 0x65, 0x66, 0x61, 0x61, 0x73]))
});
When I run this codes, Appear in server console like this below
1 .row -> <Buffer 82 80 09 f6 9f 00 04 73 65 66 61 00>
2. row -> <Buffer 30 08 00 04 73 65 66 61 61 73 30 08 00 04 73 65 66 61 61 73>
That you see in 2. row, client datas come to server together. How can I solve this problem.Thanks