C
cyril
Hi,
I have made a socket server written in C (and an associate client in
C). All is working fine when the communication is between my C coded
client and my C coded server.
But now I have to send a binary file to my C coded server via Python
.... and the server side keep bloquing on read (I try to do (on the
server side) a fcntl(socket, F_SETFL, O_NONBLOCK) but it seems to not
pass on non blocking mode - but this is not for this forum ))
I think the problem can be solved by sending an eof at the end ok
writing in the socket in Python, but I don't know how can I do that.
Actually I modified my server code and it's working fine except for a
file which size is exactly the size of the read buffer (1024 in my
server). That why I send 1020 sized data packets.
here is my pyhon client code :
wrt, addr = sock.accept()
f = open(pathOfFileToSend, 'rb')
while 1:
data = f.read(1020);
if not data :
break
wrt.send(data)
wrt.close
Thank you if you can tell me how to send an eof by socket.
I have made a socket server written in C (and an associate client in
C). All is working fine when the communication is between my C coded
client and my C coded server.
But now I have to send a binary file to my C coded server via Python
.... and the server side keep bloquing on read (I try to do (on the
server side) a fcntl(socket, F_SETFL, O_NONBLOCK) but it seems to not
pass on non blocking mode - but this is not for this forum ))
I think the problem can be solved by sending an eof at the end ok
writing in the socket in Python, but I don't know how can I do that.
Actually I modified my server code and it's working fine except for a
file which size is exactly the size of the read buffer (1024 in my
server). That why I send 1020 sized data packets.
here is my pyhon client code :
wrt, addr = sock.accept()
f = open(pathOfFileToSend, 'rb')
while 1:
data = f.read(1020);
if not data :
break
wrt.send(data)
wrt.close
Thank you if you can tell me how to send an eof by socket.