TCP functional; UDP recv doesn't receive correct packet (correct on Wireshark)

The recv_udp_packet function doesn't work; it receives the wrong data. Also, the program currently exits the thread when the TCP socket is closed.