in reply to Re: Chunked unix socket file reading - how?
in thread Chunked unix socket file reading - how?
from the side of vlc the socket stays "connected", while my cgi connects-sendsCommand-reads-terminates on each http request cycle.
The problem is with the -read- part, where my cgi can't detect so well if the issued command was answered correctly or not. On the interactive e.g. socat/netcat shell I (human) can easily see when a command is fully answered by the socket "stopping to spit out data". Anyway, my script can't be that smart.
vlc sends ~5-30 lines of answer data, each terminated by \n. That's why I try to detect common "last lines" of output - but as said, it doesn't work on every output.
Is there a way to limit my read to, let say, max 100 lines?
Or a common algorithm to set timeouts on read-while loops?