image frame send over socket in c

Hi everyone, I wanna send single image frame over socket programming in c language. My socket programming is TCP/IP socket programming. I don't know how to send image frame over socket. I will get image frame from stream. So how to do it? If anyone know, please kindly share me.thanks.
The main thing is that the sender and receiver have a common understanding of what's being transfered. So they'll need a way to communicate how much data is being sent and the format.

You can send the total size of the frame in 4 bytes to begin with. If you agree that this uint32_t is sent in network order, you can use htonl to encode it and ntohl to decode it. That'll deal with endian issues.

You can then send the rest of the data. The client will know how much data to listen for. I can't really comment the data itself at this point.

http://en.wikipedia.org/wiki/Endianness
http://pubs.opengroup.org/onlinepubs/007908799/xns/htonl.html
http://pubs.opengroup.org/onlinepubs/007908799/xns/ntohl.html
Topic archived. No new replies allowed.