XiaoFeng.Net 2.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package XiaoFeng.Net --version 2.0.2
NuGet\Install-Package XiaoFeng.Net -Version 2.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XiaoFeng.Net" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XiaoFeng.Net --version 2.0.2
#r "nuget: XiaoFeng.Net, 2.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XiaoFeng.Net as a Cake Addin
#addin nuget:?package=XiaoFeng.Net&version=2.0.2

// Install XiaoFeng.Net as a Cake Tool
#tool nuget:?package=XiaoFeng.Net&version=2.0.2

XiaoFeng.Net

fayelf

GitHub top language GitHub License Nuget Downloads Nuget Nuget (with prereleases)

Nuget:XiaoFeng.Net

QQ群号:748408911

QQ群二维码:

QQ 群

公众号:

畅聊了个科技

源码: https://github.com/zhuovi/XiaoFeng.Net

教程: https://www.yuque.com/fayelf/xiaofeng

XiaoFeng网络库,封装了Socket客户端,服务端,根据当前库可轻松实现订阅,发布等功能。

XiaoFeng.Net

XiaoFeng.Net generator with XiaoFeng.Net.

Install

.NET CLI

$ dotnet add package XiaoFeng.Net --version 2.0.1

Package Manager

PM> Install-Package XiaoFeng.Net --Version 2.0.2

PackageReference

<PackageReference Include="XiaoFeng.Net" Version="2.0.2" />

Paket CLI

> paket add XiaoFeng.Net --version 2.0.2

Script & Interactive

> #r "nuget: XiaoFeng.Net, 2.0.2"

Cake

// Install XiaoFeng.Net as a Cake Addin
#addin nuget:?package=XiaoFeng.Net&version=2.0.2

// Install XiaoFeng.Net as a Cake Tool
#tool nuget:?package=XiaoFeng.Net&version=2.0.2

XiaoFeng.Net Socket操作

服务端实例

//新建一个服务端,同时支持websocket,socket客户端连接
var SocketServer = new XiaoFeng.Net.NetServer<XiaoFeng.Net.ServerSession>(8888)
{
    //是否启用ping
    IsPing = true,
    //是否启用新行
    IsNewLine = true,
    //传输编码
    Encoding = System.Text.Encoding.UTF8
};
SocketServer.SocketAuth = session =>
{
    //判断 客户端是否符合认证,不符合则直接返回false即可
    return true;
};
SocketServer.OnClientError += (session,e)=>
{
    //客户端出错事件
};
SocketServer.OnDisconnected += (session,e)=>
{
    //断开连接事件
};
SocketServer.OnError += (session, e) =>
{
    //服务端出错事件
};
SocketServer.OnNewConnection += (session, e) =>
{
    //有新的连接事件
};
SocketServer.OnMessageByte += (session,message,e)=>
{
    //接收消息事件

    session.Send("回复客户端消息");
};
SocketServer.OnStart += (socket,e)=>
{
    //服务端启动事件
};
SocketServer.OnStop += (socket,e)=>
{
    //服务端停止事件
};
//启动监听
SocketServer.Start();
//发送消息给所有客户端
SocketServer.Send("发送消息");
//添加黑名单
SocketServer.AddIpBlack("124.2.2.2");

客户端实例

var SocketClient = new XiaoFeng.Net.NetClient<XiaoFeng.Net.ClientSession>("127.0.0.1", 8888);
SocketClient.OnStart += (socket, e) =>
{
    //启动消息
};
SocketClient.OnClose += (socket,e)=>
{
    //关闭消息
};
SocketClient.OnDisconnected += (session,e)=>{
    //断开连接消息
};
SocketClient.OnError += (socket,e)=>
{
    //出错消息
};

SocketClient.OnMessageByte += (session,message,e)=>
{
//接收信息
};

//启动客户端
SocketClient.Start();

SocketClient.Send("发送消息");
SocketClient.Subscribe("订阅频道");

SocketClient.UnSubscribe("取消订阅频道");

作者介绍

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on XiaoFeng.Net:

Package Downloads
XiaoFeng.Memcached

Memcached中间件,支持.NET框架、.NET内核和.NET标准库,一种非常方便操作的客户端工具。实现了Set,Add,Replace,PrePend,Append,Cas,Get,Gets,Gat,Gats,Delete,Touch,Stats,Stats Items,Stats Slabs,Stats Sizes,Flush_All,Increment,Decrement,线程池功能。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.5 152 10/8/2023
3.1.4 155 9/26/2023
3.1.3 143 8/29/2023
3.1.2 124 8/29/2023
3.1.1 138 8/22/2023
3.1.0 138 8/22/2023
3.0.0 115 8/3/2023
2.0.6 207 3/14/2023
2.0.5 210 3/11/2023
2.0.4 198 3/2/2023
2.0.3 223 3/2/2023
2.0.2 237 2/7/2023
2.0.1 224 2/7/2023
2.0.0 226 12/30/2022

修复小bug;