I have a bytearray
. I checked its size with len
and it's 15.000 bytes. However, when sending it through s.send()
, where s
is a socket, only 6000 bytes are sent.
Is this normal ? The next call to send
doesn't even send the rest.
CodePudding user response:
Yes, this is normal. The socket buffer kept by the kernel is only so big. You can either set up a loop:
while data:
transmitted = s.send(data)
data = data[transmitted:]
or call s.sendall(data)
which, in essence, does that for you.
CodePudding user response:
If you want to receive more bytes than the limit, there should be the following code somewhere in your Python file.
client.recv(1024)
In the above example, 1024 is the number of bytes to read from the client.
If you want more bytes, you can do the following.
bytes_to_recv = "something"
client.recv(bytes)