UDP Server C++ Class with a listening thread


DO NOT USE THIS CODE ANY LONGER. TOO MUCH OUTDATED AND BUGGY


I am sharing a code for “UDP Server C++ Class with a listening thread”. In the class “UDPThread”, a thread is running to receive a UDP packet.

<Download>

Just compile a demo program with this command. Then you will understand.

g++ demo_udp_server.cpp UDPThread.cpp -lpthread -o demo_udp_server

This is the result.

Screenshot from 2015-03-04 15:44:40

<Download>

I hope this code helps your project.

-Mok-

1 thought on “UDP Server C++ Class with a listening thread

  1. ali Marshal

    This code has lots of bugs. Dont use it. Wsastartup does not exist. Array is defined [4] but 5th index is written with a value which crashes the exe.

    Reply

Leave a Reply