Have in mind that, for each on sockread trigger, $sockerr is allocated only one value(0 = no error, 1-n = error), so checking it at different stages won't change its value.
Then the $sockerr checks inside the loop are useless, thats what I wanted to know.
Regarding the looping, the help says its better to loop instead of letting mirc retriggering the event, the first is much faster.