Giter Club home page Giter Club logo

stoolkit.socketnetwork's Introduction

SToolkit.Network

High performance, powerful, async TCP\UDP socket client\server.

NuGet AppVeyor

Install

Nuget Package

Or Nuget console

Install-Package SToolkit.SocketNetwork

Examples

#1 #2

Usage SocketServer

Including

using SToolkit.SocketNetwork;

Create server, TCP

SocketServer TcpServer = new SocketServer(NetworkType.Tcp, IPAddress.Loopback, 5400);

or UDP

SocketServer UdpServer = new SocketServer(NetworkType.Udp, IPAddress.Loopback, 5401);

Then bind events

  • OnConnected - Called when new client connected
  • OnDisconnected - Called when client disconnected
  • OnReceived - Called when received data from client
  • OnError - Called when server catch error
  • OnStart - Called when server started
  • OnStop - Called when server stoppped

Start server

TcpServer.Start();
UdpServer.Start();

All server functions

SocketServer(NetworkType type, IPAddress address, int port);
void Dispose();
void Start();
void Stop();

All server variables

string Uid;
IPAddress IPAddress;
int Port;
List<ClientConnection> ConnectedClients;
int LoopInterval;
int Backlog;
NetworkType ServerType;
bool UDPClientManage;
int UDPDataInterval;

Usage SocketClient

Including

using SToolkit.SocketNetwork;

Create client, TCP

SocketClient TcpClient = new SocketClient(NetworkType.Tcp);

or UDP

SocketClient UdpClient = new SocketClient(NetworkType.Udp);

Bind events

  • OnConnected - Called when client connected
  • OnDisconnected - Called when client disconnected
  • OnReceived - Called when received data from server
  • OnError - Called when client catch error

Connect to remote server

TcpClient.Connect(IPAddress.Loopback, 5400);
UdpClient.Connect(IPAddress.Loopback, 5401);

All client functions

SocketClient(NetworkType type);
void Dispose();
void Connect(IPAddress address, int port);
void Connect(IPEndPoint point);
void Disconnect();

All client variables

NetworkType ClientType;
int LoopInterval;
int UDPDataInterval;

stoolkit.socketnetwork's People

Contributors

kn1fe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

stoolkit.socketnetwork's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.