Hello, your script is almost perfect, you get the /sockread error because /sockread cannot be used outside socket event (mainly on sockread anyway), mIRC will trigger the on sockread event automatically for you based on some rules, all made to make the reading easy.
Remove your timer with /Sockread and put a sockread command inside the event, if you want to read line by line into a %variable, here is what you must do:
on *:SOCKREAD:mysocket: {
if ($sockerr) return
var %read
sockread %read
if ($sockbr == 0) return
;a line is guarantee to be in %read at this point but can be empty line of course.
echo -ag > %read
}
If the last line does not end with a line ending sequence, it won't get caught in this event as it won't be retriggered by mIRC, you can solve this easily by requesting the connection to be close in the header and then handling the on sockclose event for the socket, where you will be guaranteed to have the last line which you must read with var %read | sockread -f %read | echo -ag > %read.