call socket.shutdown() to flush data buffer,

otherwise socket may hang