sendf EOF by socket

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 :eek:))
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top