Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

[Multi-language library] LibNet - A networking library

network c++ c# java library

  • Please log in to reply
3 replies to this topic

#1 AlexMog

AlexMog

    CC Lurker

  • New Member
  • Pip
  • 9 posts
  • Location:Marseille - France
  • Programming Language:C, Java, C++, C#, PHP, Python, JavaScript, PL/SQL, Assembly, Bash, Others
  • Learning:Others

Posted 14 December 2014 - 09:39 PM

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.

 


  • 0

#2 AlexMog

AlexMog

    CC Lurker

  • New Member
  • Pip
  • 9 posts
  • Location:Marseille - France
  • Programming Language:C, Java, C++, C#, PHP, Python, JavaScript, PL/SQL, Assembly, Bash, Others
  • Learning:Others

Posted 15 December 2014 - 12:56 AM

The documentation is now in english :)


  • 0

#3 AlexMog

AlexMog

    CC Lurker

  • New Member
  • Pip
  • 9 posts
  • Location:Marseille - France
  • Programming Language:C, Java, C++, C#, PHP, Python, JavaScript, PL/SQL, Assembly, Bash, Others
  • Learning:Others

Posted 18 December 2014 - 11:05 PM

I'm finishing my TODO list now (Adding mutexes to the threading system), and the library will be stable (C++ Version).

Then, I will focus on the implementation of the server-part in C#, to finnaly finish with the Java version.

 

 

Enjoy.


  • 0

#4 AlexMog

AlexMog

    CC Lurker

  • New Member
  • Pip
  • 9 posts
  • Location:Marseille - France
  • Programming Language:C, Java, C++, C#, PHP, Python, JavaScript, PL/SQL, Assembly, Bash, Others
  • Learning:Others

Posted 09 March 2015 - 06:32 PM

Hey, new update

C++:

Added some more mutexes (one per socket now) to avoid memory reading/writing problems.

 

C#:

The C# client-side is fully working (mabe some errors on strings, but i'm working on it!), i'm starting the server-part.

 

Java:

The Packets works on local datas, but not with the C++ server :(.

 

Brb soon for more updates :)


  • 0





Also tagged with one or more of these keywords: network, c++, c#, java, library

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download