代码拉取完成,页面将自动刷新
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.
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;
PM> Install-Package SuperSocket.ClientEngine
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
}
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);
});
// 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"));
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。