XiaoFeng.Net
2.0.1
See the version list below for details.
dotnet add package XiaoFeng.Net --version 2.0.1
NuGet\Install-Package XiaoFeng.Net -Version 2.0.1
<PackageReference Include="XiaoFeng.Net" Version="2.0.1" />
paket add XiaoFeng.Net --version 2.0.1
#r "nuget: XiaoFeng.Net, 2.0.1"
// Install XiaoFeng.Net as a Cake Addin #addin nuget:?package=XiaoFeng.Net&version=2.0.1 // Install XiaoFeng.Net as a Cake Tool #tool nuget:?package=XiaoFeng.Net&version=2.0.1
XiaoFeng.Net
Nuget:XiaoFeng.Net
QQ群号:748408911
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.1
PackageReference
<PackageReference Include="XiaoFeng.Net" Version="2.0.1" />
Paket CLI
> paket add XiaoFeng.Net --version 2.0.1
Script & Interactive
> #r "nuget: XiaoFeng.Net, 2.0.1"
Cake
// Install XiaoFeng.Net as a Cake Addin
#addin nuget:?package=XiaoFeng.Net&version=2.0.1
// Install XiaoFeng.Net as a Cake Tool
#tool nuget:?package=XiaoFeng.Net&version=2.0.1
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("取消订阅频道");
作者介绍
- 网址 : http://www.fayelf.com
- QQ : 7092734
- EMail : jacky@fayelf.com
Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.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. |
-
.NETStandard 2.0
- XiaoFeng.Core (>= 2.0.1)
-
.NETStandard 2.1
- XiaoFeng.Core (>= 2.0.1)
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 | 210 | 10/8/2023 |
3.1.4 | 197 | 9/26/2023 |
3.1.3 | 179 | 8/29/2023 |
3.1.2 | 160 | 8/29/2023 |
3.1.1 | 171 | 8/22/2023 |
3.1.0 | 170 | 8/22/2023 |
3.0.0 | 150 | 8/3/2023 |
2.0.6 | 235 | 3/14/2023 |
2.0.5 | 239 | 3/11/2023 |
2.0.4 | 230 | 3/2/2023 |
2.0.3 | 252 | 3/2/2023 |
2.0.2 | 270 | 2/7/2023 |
2.0.1 | 259 | 2/7/2023 |
2.0.0 | 259 | 12/30/2022 |
修复有新连接时,握手成功后也回调的bug