I am working with SDL using C++. Because I did not found something suitable yet, I startet solving the problem on my own: https://github.com/cgloeckner/networking
It is a framework for C++ using SDL and SDL_net; its aim is to offer sending "events" over the network and handling them after receive. The events are enqueued in a thread-safe fifo queue before sending. Any received events are also enqueued in an also thread-safe fifo queue at the receiver's side. They will stay there until they were handled. Each event type is a derivate of the struct event. It contains an event-id to identify it at the receiver's side referring to it's original type. Then you can type-cast it to enable accessing the actual data. Both sides are using the same set of events.
This events are not allowed to carry pointers or std-containers. Only primitive data types are allowed. This is because the framework does not serialize any data before sending. So pointers or high-level containers (using pointers) cannot be sent or received, unless serializing them first.
Licence and structure
I released the project under CC BY-NC 3.0. You can find the source code at the linked GitHub-Repository: the framework is placed inside the src-directory. Also you can find two examples programs example1.cpp (a TCP- bzw. UDP-based example using NetworkingQueue directly) and example2.cpp (TCP-based example using a small server-client-structure with worker-threads for each client).
The project is already using features of C++11. Actually, I like to make it independent from C++11, because of the missing support of many compilers. That is why I implemeneted all threading stuff using SDL_thread.
I am curious about your feedback!
With kind regards
GlockeMember Since 05 Mar 2013
Offline Last Active Private