修改描述
This commit is contained in:
parent
5c377d5d4b
commit
a43245ac0e
Binary file not shown.
Binary file not shown.
24
README.md
24
README.md
@ -1,4 +1,26 @@
|
|||||||
# HaoYueNet
|
# HaoYueNet
|
||||||
|
|
||||||
.Net 6的,自建基于IOCP的TCP的高性能网络库
|
.Net 7 的,自建基于IOCP的TCP的高性能网络库
|
||||||
使用Protobuff作为通讯协议
|
使用Protobuff作为通讯协议
|
||||||
|
|
||||||
|
包含服务端和客户端双端库,可直接用于各类.Net程序或Unity程序,做TCP通讯底层库。
|
||||||
|
不用关心网络底层,直接引用或继承,即可便捷使用。
|
||||||
|
|
||||||
|
DataCallBack//网络消息事件
|
||||||
|
OnClose//连接关闭
|
||||||
|
|
||||||
|
并包含心跳包等检测、连接管理、Protobuff解析,优化后的高性能收发等等。
|
||||||
|
|
||||||
|
Simple目录下,有实例客户端和实例服务端,
|
||||||
|
示例中,使用本网络库,您可以继续示例项目写,也可以参照示例代码。
|
||||||
|
示例中实现了:
|
||||||
|
事件机制,
|
||||||
|
客户端基本框架(连接管理,数据管理,消息收发,指定用户发送)
|
||||||
|
服务端基本框架(连接管理,用户管理,消息收发,指定用户发送,广播等)
|
||||||
|
简单无OAuth登录,
|
||||||
|
用户列表,
|
||||||
|
基础的Protobuff设计,
|
||||||
|
基础聊天功能,
|
||||||
|
整合Protobuff生成。
|
||||||
|
|
||||||
|
您甚至可以
|
@ -10,18 +10,7 @@ namespace ServerCore.NetWork
|
|||||||
public IOCPNetWork(int numConnections, int receiveBufferSize)
|
public IOCPNetWork(int numConnections, int receiveBufferSize)
|
||||||
: base(numConnections, receiveBufferSize)
|
: base(numConnections, receiveBufferSize)
|
||||||
{
|
{
|
||||||
//m_clientCount = 0;
|
|
||||||
//m_maxConnectNum = numConnections;
|
|
||||||
//m_revBufferSize = receiveBufferSize;
|
|
||||||
//// allocate buffers such that the maximum number of sockets can have one outstanding read and
|
|
||||||
////write posted to the socket simultaneously
|
|
||||||
//m_bufferManager = new BufferManager(receiveBufferSize * numConnections * opsToAlloc, receiveBufferSize);
|
|
||||||
//m_pool = new SocketEventPool(numConnections);
|
|
||||||
//m_maxNumberAcceptedClients = new Semaphore(numConnections, numConnections);
|
|
||||||
|
|
||||||
|
|
||||||
ClientNumberChange += IOCPNetWork_ClientNumberChange;
|
ClientNumberChange += IOCPNetWork_ClientNumberChange;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IOCPNetWork_ClientNumberChange(int num, AsyncUserToken token)
|
private void IOCPNetWork_ClientNumberChange(int num, AsyncUserToken token)
|
||||||
@ -72,6 +61,5 @@ namespace ServerCore.NetWork
|
|||||||
Console.WriteLine("断开连接");
|
Console.WriteLine("断开连接");
|
||||||
ServerManager.g_ClientMgr.SetClientOfflineForSocket(sk);
|
ServerManager.g_ClientMgr.SetClientOfflineForSocket(sk);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user