The socket is closed when $new_sock goes out of its scope, which is the "if" statement, so the socket IS closed when the outer "while" repeats. All the parent has to do is exit the "if".
In reply to Re^3: TCP Server using fork to accept multiple requests
by tybalt89
in thread TCP Server using fork to accept multiple requests
by Lucas Rey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |