G
G
Grandma Luda2021-10-18 21:44:26
Python
Grandma Luda, 2021-10-18 21:44:26

My exe file is not being transferred correctly, what should I do?

when transferring txt, jpg, everything is fine, but when transferring an exe file, it does not start

the server code that sends the file

file = open("starting.exe", mode="rb")
print(1)
await self.main_loop.sock_sendfile(listened_socket, file, offset=0)


client code that receives the file
from socket import*

client = socket(
    AF_INET,
    SOCK_STREAM
)
client.connect(("127.0.0.1", 5843))
client.settimeout(3)

data = client.recv(2048)

file = open("starting2.exe", "wb")
while data:
    try:
        data = client.recv(2048)
        file.write(data)
    except: break
    
input("11")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-10-19
@KirasiH

what means "the text file is transferred normally"? You throw away the first 2048 bytes at reception.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question