C
C
ConterBox2022-04-21 15:09:34
Python
ConterBox, 2022-04-21 15:09:34

Why does the file not reach (Socket)?

I'm trying to send a file via socket in python, but the file doesn't reach completely.
Sender:

f=open("png.png", "rb")
client_socket.send(f.read())

Receiving:
data = conn.recv(1024)
n=open("scr.png", "wb")
n.write(data)
n.close()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TheMade, 2022-04-22
@TheMade

The "conn.recv(1024)" function specifies the maximum size of received bytes.
You can change it to accept files larger than 1024 bytes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question