I have a client and server that communicate using TCP. I want to transfer data from the client to the server.
client:
import socket
V=''
for i in range(1,400)
V=V+"%s %s %s" %s (i,i,i)
s = socket.socket(socket.AF_INT,socket.SOCK_STREAM)
s.connect((IP,PORT))
s.send(V)
s.close
and the server:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
while 1:
connection, addr = s.accept()
V_recived = connection.recv(8192)
when I run these two scripts, I see that the size of V on the client computer is 4485 bytes and on the server computer the size of V_received changes between different runs: most of the time it is 1481 bytes and some time is is 4485 or less. For my understanding, the use of the TCP protocol supposed to guarantee that all my data will be transfer, therefore I dont understand what am I doing wrong...
Any ideas?