Update network.c

Do FD_ZERO and FD_SET in loop