• This repository has been archived on 28/Jul/2020
  • Stars
    star
    365
  • Rank 116,437 (Top 3 %)
  • Language
    C#
  • Created about 12 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A .NET library which can make your socket client development easier

SuperSocket.ClientEngine Build Status NuGet Version

SuperSocket.ClientEngine is a .NET library for socket client rapid development. It provides easy to use and efficient APIs to simplify your socket development work about asynchronous connecting, data sending, data receiving, network protocol analysising and transfer layer encryption.

Build from Source Code

1. Download source code from Github or clone the repository;
2. Restore dependencies using NuGet; (Latest NuGet Visual Studio extension will restore dependencies before build automatically. You also can follow [This NuGet doc](https://docs.nuget.org/consume/package-restore#package-restore-approaches) to do it manually.)
3. Choose a correct solution file to build;

Install from NuGet

PM> Install-Package SuperSocket.ClientEngine

Usage

Create your ReceiveFilter Implementation according Your Network Protocol

SuperSocket.ClientEngine provides some powerfull basic ReceiveFilter classes (under the namespace "SuperSocket.ProtoBase") to help you simplify your protocol analysis:

TerminatorReceiveFilter
BeginEndMarkReceiveFilter
FixedHeaderReceiveFilter
FixedSizeReceiveFilter
CountSpliterReceiveFilter

You should design your own ReceiveFilter according yoru protocol details base on the basic ReceiveFilters provided by SuperSocket.ClientEngine:

class MyReceiveFilter : TerminatorReceiveFilter<StringPackageInfo>
{
	public MyReceiveFilter()
	: base(Encoding.ASCII.GetBytes("||")) // two vertical bars as package terminator
	{
	}
	
	// other code you need implement according yoru protocol details
}

Create an Instance of EasyClient and Initialize it with the ReceiveFilter which is created in the previous step

var client = new EasyClient();

// Initialize the client with the receive filter and request handler
client.Initialize(new MyReceiveFilter(), (request) => {
	// handle the received request
	Console.WriteLine(request.Key);
});

Make a Connection and then Start the Communication

// Connect to the server
var connected = await client.ConnectAsync(new IPEndPoint(IPAddress.Parse("192.168.10.11"), 25));

if (connected)
{
	// Send data to the server
	client.Send(Encoding.ASCII.GetBytes("LOGIN kerry"));
}

More Repositories

1

SuperSocket

SuperSocket is a light weight, cross platform and extensible socket server application framework.
C#
3,758
star
2

WebSocket4Net

A popular .NET WebSocket Client
C#
745
star
3

SuperWebSocket

SuperWebSocket is a .NET implementation of WebSocket server.
C#
498
star
4

LogMaster4Net

A central log server written in C#, which can ship your logs in your different applications and different locations to one place
C#
141
star
5

Tailf

Tailf is a C# implementation of the tail -f command available on unix/linux systems. Differently form other ports it does not lock the file in any way so it works even if other rename the file: this is expecially designed to works well with log4net rolling file appender.
C#
46
star
6

NRack

NRack is a server application container, which can be used for your back end services' hosting and management.
C#
40
star
7

SuperSocket.ProtoBase

SuperSocket.ProtoBase is a protocol analysis library for stream data.
C#
31
star
8

dotnetcore-samples

dotnet core sample projects
C#
29
star
9

BouncyCastle.Crypto

BouncyCastle.Crypto
C#
26
star
10

NetInteractor

Web operation automation library
C#
23
star
11

SuperSocket.Document

SuperSocket documentation
11
star
12

AnyLog

A logging framework abstraction like Common.Logging but will be better than it in some aspects
C#
9
star
13

CertificateCreator

C#
9
star
14

SuperSocket.ServerManager

C#
7
star
15

Plot4Net

A C# plotting library using SkiaSharp as the drawing tool
C#
5
star
16

DynamicViewModel

C#
2
star
17

Blogs

1
star
18

TensorflowNet.Data

C# port of tf.data
C#
1
star
19

IrvineCSharpCourses

C#
1
star
20

DynamicMvc

C#
1
star
21

langlab

Go
1
star
22

TensorFlowObjectDetection

Try out TensorFlow Object Detection with TensorFlow.NET
C#
1
star
23

kerryjiang.github.com

1
star