user3234
user3234

Reputation: 103

Receiving data in packets on TCP client

Does recv() call intercepts data in packets or can i get data packets with timestamps?

Upvotes: 0

Views: 998

Answers (3)

Arunmu
Arunmu

Reputation: 6901

If your own code is sending data to the remote machine where you are receiving data...then you can make you r own application level data format...such as sending the data after sending timestamp (some specified number of bytes).

This information can be extracted at the receiving end. Although as mentioned connection is TCP ...the data would be in stream format not as a complete packet as in case of UDP.

Upvotes: 0

Ben Voigt
Ben Voigt

Reputation: 283893

On a datagram socket (like UDP), recv gets data in datagrams. TCP is a stream-mode socket, however, and recv gets a collection of bytes with no regard for packets.

It's possible, using low-level APIs, to get the packets, but if you were hoping to see boundaries between send calls you are out of luck... that information is not present in the packets.

Upvotes: 2

Fred Nurk
Fred Nurk

Reputation: 14222

Recv gets data from a socket that has been successfully received. It does not tell you when that happened; i.e. no timestamp.

Would you elaborate on what problem you're trying to solve ("why do you need this?") instead of your attempted solution? (Or have I completely misunderstood your question?)

Upvotes: 1

Related Questions