transfer binary over socket
I want to transfer a binary file over a socket.
The file has been fread into a character buffer and can be successfully fwritten back out locally. Using write and read on the socket file descriptors seemed to work in the sense that a file of the correct size is transferred, but it's not executable (or viewable, with an image).
If I want to use fread and fwrite, I have to use fdopen on the socket descriptor to get a stream. This works on the transmission end, but
FILE sstrIN=fdopen(fd,"rb");
fails, altho fcntl reports the read flag is set for fd. Am I going about this the wrong way, or are there more details?