This project is read-only.

About

OpenServe.NET is a public open library that allows client-server communication on a secure and non-delayed medium. This 2-tier networked library has been specially designed to give the utmost modification flexibility while maintaining ease of use and security(SSL).

Usability

When we take a look at usability of the OpenServe.NET Library, we can strictly see that there are two main fundamental platforms that need to be structured before client-server communication can start.

Server-Side

OpenServe.Net.Server.cs

Instantiation

To use the server side functionality within an application, the application has to instantiate the Server class. This can be done as follows:

//With default port of  5000

Server OpenServeServer = new Server();

//With specified port of 500

Server OpenServeServer = new Server(500);

Properties

The Server Class contains the following properties:

bool Server.Secure

By setting this value to true, your server application will receive and transmit all client-server communication over a SSL(Socket Secure Layer) which will in turn mean a reliable fast exchange of data between the OpenServe.Net.Server and OpenServe.Net.Client.

Server OpenServeServer = new Server();

OpenServeServer.Secure = true;

By setting this value to false, SSL will be disabled.

List<OpenServe.Net.Client> Server.Clients

This is an IEnumerable<> object provided by the .NET Framework, that will allow you to manipulate the OpenServe.Net.Client s connected to your server application

Methods

The OpenServe.Net.Server contains three methods:

Server.AddHandler(OpenServe.Net.Library.Interface.IMsgHandler handler)

This method allows developers to create their own handlers that will be handled by the OpenServe.Net.Server class in order to extend its default behavior thus allowing full modification to the developers will in order to achieve any goal while using this library.

Server.Start()

The Server will always start on the IP address of the local machine (The machine on which the server application will run), and on a default port 5000(If no other port was specified). When this method is executed, the server will start listening to incoming OpenServe.Net Clients in order to create a two way communication channel between server and clients in a multithreaded environment.

Server.Stop()

By executing this method, all connections will be forcefully closed and the server application will stop listening to incoming clients as well as all remaining client objects used will be cleared out of memory by the garbage collector.

Client-Side

OpenServe.Net.Client

Instantiation

When adding the functionality to the client application, the only thing that is needed is to instantiate the object, set a property if necessary, connect to the server IP Address and Port.

Client OpenServeClient = new Client();

Properties

The Client Class contains the following properties:

bool Client.Secure

By setting this value to true, your client application will receive and transmit all client-server communication over a SSL(Socket Secure Layer) which will in turn mean a reliable fast exchange of data between the OpenServe.Net.Server and OpenServe.Net.Client.

Client OpenServeClient = new Client();

OpenServeClient.Secure = true;

By setting this value to false, SSL will be disabled.

byte[] Client.Buffer

By setting this array to a fixed size, you limit the size of the data chucks that will be read from the communication channel.

Client OpenServeClient = new Client();

OpenServeClient.Secure = true;

OpenServeClient.Buffer = 4000;

string Client.Name

By setting this property, you will assign a name to a client that will identify him when data is being exchanged between the client and server..

Client OpenServeClient = new Client();

OpenServeClient.Secure = true;

OpenServeClient.Buffer = 4000;

OpenServeClient.Name = “Client”;

Guid Client.GUID

By using the Client’s GUID, you can assign an unique client identification to be used during server-client communications.

Methods

The OpenServe.Net.Server contains the following methods:

Client.Connect(string Host-IP, int Port)

Whent this method is executed with the correct arguments, the OpenServe.Net.Client will attempt to connect to the host-IP address and designated port. If the connection succeeds, communication between the server and the connection client can begin. If the connection fails, an Exception will be raised

Client.AddHandler(OpenServe.Net.Library.Interface.IMsgHandler handler)

This method allows developers to create their own handlers that will be handled by the OpenServe.Net.Client class in order to extend its default behavior thus allowing full modification to the developers will in order to achieve any goal while using this library.

Client.Send(OpenServe.Net.Messaging.Message Msg)

This method allows the developer to send an OpenServe.Net.Messaging.Message from the OpenServe.Net.Client to the OpenServe.Net.Server, which then will be handled by the server application default messaging handler.

The OpenServe.Net.Messaging.Message objects consists out of a body and a header.

Conclusion

OpenServe.Net is a secure, easy to use and fully modifiable messaging library, perfect for client-server applications

Last edited Jun 22, 2012 at 8:30 AM by ravencoder, version 3

Comments

ravencoder Oct 19, 2012 at 2:12 PM 
custom behavior can be implemented by creating an object that implements the IMsgHandler interface and then added that object tot he list of handlers on both the client and the server side. but calling the .Handlers.Add() funtion. custom behaviour then lives inside the new class you created that implemented the IMsgHandler interface. how this works is there is a call in the interface called HandleMessage and that method is called everytime the client or server receives a message. so you can do you custom behavior handlers in there what to do what that message is received.

alexchandel Oct 19, 2012 at 12:22 PM 
This doesn't talk about how Message Handlers work/when they are called, nor how to implement custom behavior. I'd like to know that.