/sockmark is used to keep a short note attached to a socket connection, it can only store 512 bytes of text. This text is never sent to the destination of the socket, it's just a post-it on a socket.

$readn is only used after a $read statement, and $read can only read from filed on your computer. It has nothing to do with sockets.

Since you say you understand /sockopen and /sockread: to scan for a line of text, just /sockread %text and then compate that %text to what you scan for, if it's in there you have found it, otherwise /sockread again.

If you want to keep the line numbers: do /inc %socketcounter after each /sockread. (For a website you want to only start doing this after all headers are sent) Once you find the text you were looking for, the value of %socketcounter is the line number you want. Also, put /unset %socketcounter in the script that opens the socket.