解决SuperSocket SuperWebSocket并发数100限制的问题

 我们先看以下如下代码:

var wsSer = new WebSocketServer();
wsSer.NewMessageReceived += wsSer_NewMessageReceived;//有消息传入时事件
wsSer.NewSessionConnected += wsSer_NewSessionConnected;//当有客户端连入事件
wsSer.SessionClosed += wsSer_SessionClosed;//当客户端关闭时
wsSer.NewDataReceived += wsSer_NewDataReceived;//当有数据传入时事件
if (wsSer.Setup(10086))//绑定端口
    wsSer.Start();//启动服务


这段代码的并发最大100,因为Setup函数默认就是100,以下代码实现10万的并发。

var wsSer = new WebSocketServer();
wsSer.NewMessageReceived += wsSer_NewMessageReceived;//有消息传入时事件
wsSer.NewSessionConnected += wsSer_NewSessionConnected;//当有客户端连入事件
wsSer.SessionClosed += wsSer_SessionClosed;//当客户端关闭时
wsSer.NewDataReceived += wsSer_NewDataReceived;//当有数据传入时事件
var config = new ServerConfig();
 config.Port = 10086;
config.Ip = "127.0.0.1";
config.MaxConnectionNumber = 100000;//最大并发数量
  if (wsSer.Setup(config))//绑定端口
        wsSer.Start();//启动服务


Quote:https://www.itxst.com/detail/jefuqnzj.html