binary I/O on sockets

I'm trying to put together a small program to transfer a binary file using sockets. The problem I'm experiencing is when I try to send a buffer with a "\0" character in it, the read hangs.

Is there a way to configure the socket to accept all data, and only terminate when the read buffer is full (or an error occurs)?

Thanks.

EDIT: after looking at it a bit more closely, it appears that it's the write, not the read, that terminates on a null character. Still, if there's a way to defeat this, I'd love to know about it.

Last edited on
There is no problem with writing null bytes to a socket.
The problem is somewhere else, probably how you pass around the data to be sent.
You are right -- I had used strlen to derive the length of the packet. Obviously that won't work.

Thanks.
Topic archived. No new replies allowed.