I'm trying to record a jpeg image sent by an Ethernet camera in a mjpg stream. The images I obtain with my Borland C++ application (VSPCIP) are sometimes "corrupted" : I have the example of a "corrupted jpeg frame" : it has 21690 characters (for a 640x480 jpeg image) and among them there is a string of 5045 following characters which have the value "NUL" (displayed as NUL in Notepad++). And because I stop reading bytes when I reach the "content-length" specified in the mjpg header, the following bytes are cut off.
Two things : - I would first like to remove these corrupted frame : how may I detect (quickly) a string of let's say more than 50 (or directly 5000 or 5045) following "NUL" characters) ? - I have to find why my application adds this string of following "NUL" characters.