controllers: tcpip: use shutdown instead of close
When close(fd) is used on the a TCP/IP socket in Linux, it puts the socket
into a FIN_WAIT1 state and the TCP/IP connection is not completely severed
until the application terminates. On the server side, this has the effect
of keeping sockets open for an unnecessarily long period of time. If the
server is a memory-contstrained device such as a microcontroller, that
can have very negative effects.
For that reason, it is preferred to use shutdown(fd, SHUT_RDWR) instead.
Signed-off-by:
Christopher Friedt <chrisfriedt@gmail.com>
Please register or sign in to comment