in reply to Chunked unix socket file reading - how?

...when the socket stops to spit out data

What exactly does that mean? Is the socket being closed on the other side, or does it simply no longer send data; are there always complete lines (terminated by \n), etc...?

Replies are listed 'Best First'.
Re^2: Chunked unix socket file reading - how?
by Anonymous Monk on Nov 18, 2009 at 19:54 UTC
    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?