Set a variable when you read the CRLF...
on *:SOCKREAD:membership: {
if ($sockerr) halt
else {
while ($sock($sockname).rq) {
sockread &binvar
if (%now) bwrite membership.xml -1 -1 &binvar
elseif ($bvar(&binvar,1-) == 13 10) set %now $true
}
}
}
You need to make sure you unset the %now variable later though... your best bet is probably to do it in the sockclose event, or whenever you close the socket.