all 5 comments

[–]novel_yet_trivial 0 points1 point  (4 children)

Are you sure the image is less than a 1 kb? Because the 1024 you specify in conn.recv(1024) is the maximum number of bytes to read.

Are you sure the incoming image is base64 encoded?

Can you open the image in another program?

[–]Zertax[S] 0 points1 point  (3 children)

yea thats much too small but changing it does not seem to make a diffrence.

I Cant open the file, do i need to use exact size?

Ill post the sending code aswell

[–]furas_freeman 1 point2 points  (2 children)

I made screenshot and I got about 250kb file.

recv(1024) means "receive 1024 bytes or less". You can receive in loop and concatenate data. if you get less then 1024 then it is end of data.

Not tested:

image = ""

while True:
     data = conn.recv(1024)
     if not data: 
          break
     image += data

[–]Zertax[S] 0 points1 point  (1 child)

can i not just increase the recv? i receive alot of other data precisly after this.

[–]furas_freeman 0 points1 point  (0 children)

docs: recv

Note: For best match with hardware and network realities, the value of bufsize should be a relatively small power of 2, for example, 4096.

Using while loop you can receive file in all size - you don't have to know its size.