Is it possible for the recipient to define the "boundary packets" of TCP sender?

Colleagues, crooked get the question. To clarify. Iteresuet response from experts who understand TCP/IP.

As I understand it, the MTU for Ethernet is about 1500 bytes. Accordingly, if I do a sending to a socket of a smaller number of bytes, they can stay in the buffer until the next (few) submissions, if there is no flag PSH. All right?
The recipient (for example, the example NodeJS) will pull colback to get the data to the socket for each of my messages. For each of my separate parcels, the smaller 1500 and is equipped with a PSH. And it may happen that a packet is fragmented on the way? And come two TCP packets? And then I get two calls of colback?

Or, if I send more than 1500, then it just goes away in several packages. It will be several calls of Albekov on the receiving side? Guaranteed as long as packages or unpredictable? Or else it may interfere with the cyclical nature of the survey in the event the machine is NodeJS and wyciek and kolbikov may be a different number?

I'm trying from one process to another nodejs to throw in the 60K socket and get 4 call of colback on the receiver. It seems to be less than on a call to the package, but more than one call for the whole package.

Accordingly, question two:
- Predictable if the number of Kabakov?
- Is it possible to understand, that these TCP packets is one premise of the customer? Saw the analyzer is reassembled some packets, but don't know what it is.

The question is asked because I want to know can I on the receiver to as if the event "the client has sent the parcel." And no matter how much it missed TCP packets.
Or not? Or just a pipe from which the bytes fall in the correct order, but without any borders, or at least not corresponding to the write operations to the socket from the sender.

If vaguely outlined - complement.
September 19th 19 at 14:15
2 answers
September 19th 19 at 14:17
you have to start reading a wonderful tutorial Sneijder - Effective programming TCP/IP

In short - you have to send data before passing the data length of a transmitted, then take the pieces, add length and gather them from the end.

You should never be tied to the fact that TCP inside cut the flow of bytes per datagram. For the programmer the TCP pipe with two sockets, one on the client, the second - on the server.
Well I would have done:
>As a result, with nothing better to do as first send the file size and then just count the number of received bytes to know where is the end. - cedrick41 commented on September 19th 19 at 14:20
Yes, but in the process you have done some very dangerous assumptions that should not be done. Look through the tutorial, there's a lot of useful data transfer over the network. - Electa.Lynch7 commented on September 19th 19 at 14:23
September 19th 19 at 14:19
I tried to make prinimala images via TCP node.js and also faced with this problem.
In the result, with nothing better to do as first send the file size and then just count the number of received bytes to know where is the end.

Now, googling and write what you can find out where the end of transmission \n
Ie if come end-line - means that the transmission is finished.
That's weird. I standard did not thoroughly read, but as far as I know - there are no control characters. CRLF - this is from the application Protocol. For example, separates the HTTP headers from the body. In my case the data is binary. To enter the escape character - do not want. Therefore, trying to understand - on the basis of TCP packets is it possible to understand start/end of transmission in a single connection... - cedrick41 commented on September 19th 19 at 14:22
: think I found something. Using connection.end() can trigger callback to "end" on the server side. I.e., begin and accept the data as data, and when data end end we get a callback. - Electa.Lynch7 commented on September 19th 19 at 14:25

Find more questions by tags Computer networksNode.jsNetwork administration