unwanted “NUL” characters string after reading bytes of a mjpg TCP stream

為{幸葍}努か 提交于 2020-01-06 12:42:34

问题


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.

来源:https://stackoverflow.com/questions/8853460/unwanted-nul-characters-string-after-reading-bytes-of-a-mjpg-tcp-stream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!