on *:SOCKREAD:sock: {
if ($sock($sockname).mark) {
sockread &bvar
if ($sockbr == 0) return
; do stuff with &bvar
}
else {
var %line
sockread %line
if (%line == $null) sockmark $sockname $true
}
}
Unless you specifically need binary support (why you'd need it for XML I'm not too sure), you should probably be reading with regular vars though.