Hello,
First of all, I want to excuse myself to my bad english, I'm french.
I want to introduce you the LibNet. A networking library that I am working on.
I - Goals of the library.
The goal of the library is to simplify the networking-oriented-programming.
At first, this library was developped to another project (Highlands Framework (who is a MMO programming framework)) who is still in developpement.
We decided to adapt this library in other languages, and to make it OpenSource, in order to help other people who needs the same tools.
The library is thought to simplify the network communication between multiple programming languages. It is alsow adapted for TCP and UDP, but a bit focused for TCP usage.
It has alsow multiple encapsulations (such as the Selector, Mutex, CondVar, Thread, Socket, etc...) that can help you with your own projects.
The library is alsow adapted for asynchronous and synchronous usage, with objects like TcpASIOServer that allows you to create a Asynchronous server with only few lines of code. (It uses 2 threads: A Listening one (TcpASIOListener), and a writing one (TcpASIOWriter)).
II - Advancement.
I'm actually actively developping this project, and he is at his first steps.
For the moment, the C++ version (including server and clients implementations) is actually working.
I'm working with another developper on the C# version, and alsow on a Java version.
III - What is expected in that library?
There is a list of what I want to add after to the library (with a priority on the C++ version):
- The websocket protocol
- Few implementations for the HTTP protocol
- Few implementations for the FTP protocol
IV - A little example.
There is a little example of a simple ASIO server using the library:
#include <mognetwork/Packet.hh> #include <mognetwork/TcpASIOServer.hh> #include <mognetwork/TcpASIOWriter.hh> #include <stdio.h> #include <iostream> #include <exception> mognetwork::TcpASIOServer* server; // yup, it's a global, not good, but useful for tests... // We have to handle the CTRL+C command to allow the server to free his datas void shandler(int) { std::cout << "Stopping server..." << std::endl; server.stop(); } int main(void) { mognetwork::TcpASIOServer server_instance(4242); // preparing the server on the port 4242 server = &server_instance; signal(SIGINT, shandler); // Handling the CTRL+C std::cout << "Starting server..." << std::endl; try { server.start(); // We start the server! This will wait ultil the Listening thread and the Writing thread have stop. std::cout << "Server ended." << std::endl; } catch (const std::exception& e) { std::cerr << e.what() << std::endl; } std::cout << "Finish." <<std::endl; return (0); }
So as you can see, it's really simple to create a server with this library. (If you want to handle datas, you will have to use a Listener, I will do a tutorial on the github wiki and on this forum).
V - Links and thanks.
I hope you will find utility of that library, and I hope you've understanded me, despite my poor English.
There are the links of the sources and more informations:
Sources:
C++: https://github.com/AlexMog/LibNet
C#: https://github.com/A...og/LibNetCSharp
Java: https://github.com/AlexMog/LibNetJava/
Doc:
C++: http://alexmog.labs-...k-doc/doc/html/ (yup, the doc is in french, I'm rewriting it in english, it will come soon in english)
C#: Comming soon
Javadoc: comming soon
Do not hesitate to tell me what you think about the library!
Have fun!
Thank's for reading!
AlexMog.