Each time through, you should construct a buffer that contains the image size (list of 3 doubles) followed by the image data. fwrite that to the socket.
on the receiving side, fread 3 double. That will be the image size. Now fread with that size and '*double' precision.
You might find that in practice you need to break the sending data into smaller chunks. If so then still have that buffer I mentioned, but fwrite smaller portions of it.
If you do that then on the receiving side have a small state machine. You start waiting for an image. loop fetching bytes available into a variable and fread that many bytes as *uint8, and put onto the end of your current input buffer.
If you are in the first state and there are less than 24 bytes in the buffer, loop back to waiting for bytes available.
If you are in the first state and your buffer has more than 24 bytes then typecast the first 24 as double to find the current image size, and remove those 24 from the buffer and calculate the product times 8... that's the number of bytes you need for the image. Enter the second state, where you are waiting for data to finish.
If you are in the second state and your buffer is less than the number of bytes you need then loop back to waiting for bytes available.
If you are in the second state and you have enough bytes, then pull the appropriate number of bytes from the front of the buffer and typecast to double and reshape to the size read. Then remove those bytes from the buffer. Display the image and change to the first state and loop back.
This needs a minor flow change such that if you are state 1 and there are at least 24 bytes in the buffer, you can skip waiting for bytes to be available and more on to extracting the size information and switching to state 2. Likewise at state 2 if you already have enough bytes you do not need to listen for more right now. This minor revision to what I described first makes it easier to deal with streams of bytes in the buffer, where you might already have received some of what you need for the next image.
You need to decide on a protocol to signal end of stream. That might be, for example, sending 0 as the image size.
Is there any particular reason why you want to send double precision images? Most webcam images are 8 bits per pixel, 16 at most, so double precision is usually a waste.