How to write byte data from socket into an unsigned char vector in C?
I am developing a server in C using bsd sockets in which i am receiving jpeg frames from clients.

The frame data arrives at the server as a stream of byte data of jpeg format.

Since the byte equivalent is unsigned char in C, i am receiving this data into an unsigned char vector over several iterations of the sock.recv() function.

The problem is that when i write this data to a .jpg file, it shows the file size as 4 bytes only.

I have also checked the that number of bytes that are picked from the recv buffer over all iterations for a frame is equal to the total size of the sent frame, but somehow they are not written properly in the vector i have used.

Does anyone knows how to go about it ? Thankyou !  
How to write byte data from socket into an unsigned char vector in C?
===

I am developing a server in C using bsd sockets in which i am receiving jpeg frames from clients.

The frame data arrives at the server as a stream of byte data of jpeg format.

Since the byte equivalent is unsigned char in C, i am receiving this data into an unsigned char vector over several iterations of the sock.recv() function.

The problem is that when i write this data to a .jpg file, it shows the file size as 4 bytes only.

I have also checked the that number of bytes that are picked from the recv buffer over all iterations for a frame is equal to the total size of the sent frame, but somehow they are not written properly in the vector i have used.

Does anyone knows how to go about it ? Thankyou !  