J
jaco.versfeld
Hi There,
I have a basic TCP client and TCP server in C++. The TCP client
connects to the server, and after a setup phase starts to transmit a
file to the TCP server using multiple packets (fixed amount of bytes,
except for the last packet). This is accomplished by using a for loop
and the "int send(socket, buffer, bufferlength, 0)" function.
When I read the packets using "int recv(socket, buffer, 1500, 0)" the
number returned by the function is 1500, although the "data" packets
that I have sent each contains less bytes (1310 bytes). It seems that
with each recv() function, I get 1500 bytes from the network buffer,
and that I have lost "synchronisation" - I don't read packet for
packet, but a chunk of the network buffer. Is this the normal
operation of TCP, or did I break something along the way? (I would
hope that each recv function would return 1310, the size of the
original packet.)
Any help, suggestions and comments will be greatly appreciated
Jaco
I have a basic TCP client and TCP server in C++. The TCP client
connects to the server, and after a setup phase starts to transmit a
file to the TCP server using multiple packets (fixed amount of bytes,
except for the last packet). This is accomplished by using a for loop
and the "int send(socket, buffer, bufferlength, 0)" function.
When I read the packets using "int recv(socket, buffer, 1500, 0)" the
number returned by the function is 1500, although the "data" packets
that I have sent each contains less bytes (1310 bytes). It seems that
with each recv() function, I get 1500 bytes from the network buffer,
and that I have lost "synchronisation" - I don't read packet for
packet, but a chunk of the network buffer. Is this the normal
operation of TCP, or did I break something along the way? (I would
hope that each recv function would return 1310, the size of the
original packet.)
Any help, suggestions and comments will be greatly appreciated
Jaco