Clean shutdown of c++ sockets

#c++ #modbus #networking #select #self-pipe #sockets