Jump to content

  • Log In with Google      Sign In   
  • Create Account

[C++ Framework] Event-based Networking


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Glocke   Members   -  Reputation: 142

Like
1Likes
Like

Posted 05 March 2013 - 03:34 AM

Hi there,

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.

Limitations

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).

Additional notes

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
Glocke

Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5716

Like
0Likes
Like

Posted 06 March 2013 - 01:02 PM

Thanks for letting us know.
enum Bool { True, False, FileNotFound };

#3 Glocke   Members   -  Reputation: 142

Like
0Likes
Like

Posted 07 March 2013 - 02:15 AM

Is this a good or bad feedback? :)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS