That would also mean that if a header is sent in on sockopen event, I have to check after every /sockwrite if $sockerr is > 0, I saw nobody doing that so far?
No, the error check should be done only once, generally at the top of the event.
Let's take an example (which is the way things should be done)
On *:SockOpen:Name:{
If $sockerr { Echo -st - Error on $sockname - | Return }
Var %s = SockWrite -n $sockname
%s NICK SomeNickname
%s USER something something something :Just Testing
}
Of course, something like the following is useless.
On *:SockOpen:Name:{
If $sockerr { Echo -st - Error on $sockname - | Return }
Var %s = SockWrite -n $sockname
%s NICK SomeNickname
If $sockerr { Echo -st - Error on $sockname - | Return }
%s USER something something something :Just Testing
If $sockerr { Echo -st - Error on $sockname - | Return }
}
Because, in the case of an error, the socket is automatically closed by mIRC, so a unique check will do it.
NB: Note the use of "Var %s = SockWrite -n $sockname", which is not a compulsory method. I like to do that when I'll have to do a series of /sockwrite. It then neatens the source. It's only a matter of taste and aesthetics.