2 Star 5 Fork 3

kerryjiang / SuperSocket.ClientEngine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

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"));
}

空文件

简介

A .NET socket client library 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C#
1
https://gitee.com/kerryjiang/SuperSocket.ClientEngine.git
git@gitee.com:kerryjiang/SuperSocket.ClientEngine.git
kerryjiang
SuperSocket.ClientEngine
SuperSocket.ClientEngine
master

搜索帮助