in reply to Re^2: TCP Server using fork to accept multiple requests
in thread TCP Server using fork to accept multiple requests

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".

  • Comment on Re^3: TCP Server using fork to accept multiple requests

Replies are listed 'Best First'.
Re^4: TCP Server using fork to accept multiple requests
by NERDVANA (Priest) on Aug 20, 2022 at 23:26 UTC
    Post updated. Sorry for the noise.