A
A
AvengerBoxer2014-05-22 07:27:07
Node.js
AvengerBoxer, 2014-05-22 07:27:07

Is it possible in node.js (net module) to accept corrupted data via TCP/IP?

Hello, there is a server that sends xml documents:

<xml>DATA</xml>
<xml>text</xml>

and there is a node.js client that connects to the server:
var net = require('net');
var client = net.connect({port: 8124},
  client.on('data', function(data) {
       console.log(data.toString());
  });

Considering that the server is also working correctly and sending good data,
the question is whether it is possible that during an event
client.on('data'
I will receive
<xml>DAext</xml>
<xml>teTA</xml>

due to problems in the network or switching equipment?
Or will tcp and node.js take care of me in this case, then what's the most broken thing I can get?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-05-22
@AvengerBoxer

in theory, the operating system should take care of this, which, having received a beaten tcp packet, will check the hash sum with the one indicated in the packet headers and simply throw it away, after which the sender will receive an ICMP error message, and he will send the packet again.

E
Eugene Obrezkov, 2014-05-22
@ghaiklor

The TCP mechanism provides a connection-preset data stream, re-requests data in case of data loss, and eliminates duplication when receiving two copies of the same packet, thereby guaranteeing, unlike UDP, the integrity of the transmitted data and notification of the sender about the results of the transmission.
(c) Wikipedia
NodeJS can accept chunks. Accordingly, overflights may occur on your side at this moment if you do not take care of it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question