Please stop posting variations on the same code in so many places. I already explained here that it will not work to read a single byte and type cast it to a 4-byte value; you'll get the wrong result, and will then read the wrong number of bytes following. If your C code generates a continuous stream of numbers, and doesn't send a length first, then you should do a single TCP Read for the correct number of bytes. It doesn't help to copy examples blindly if you don't take the time to understand what they do. Also, your code reads and discards data until the stop button is pressed, at which point it tries to convert whatever random data was read most recently into an image. Does your C code send the array dimensions? If not, then your array manipulation won't work. In what format does your C program send data?
↧