This project is read-only.
2
Vote

SuperWebSocket: After restarting the program the server continues to listen a port

description

I'm using SuperWebSocket in my application, instance WebSocketServer with next configuration
        var rootConfig = new RootConfig();
        var serverConfig = new ServerConfig
                           {
                               Name = $"WebSocketName_{config.Host}:3202",
                               Mode = SocketMode.Tcp,
                               Ip = config.Host,
                               Port = config.Port,
                               MaxRequestLength = 80485760, // 80Mb 
                               MaxConnectionNumber = 200,
                               LogAllSocketException = true,
                           };

        this._webSocketServer = new WebSocketServer();
        this._webSocketServer.Setup(rootConfig, serverConfig, logFactory: new Log4Net2NLogFactory());
However, after restarting the program I catch an exception:

Error Exception: 'System.Net.Sockets.SocketException (0x80004005)

How i can close the web socket server correctly during closing my applicaion.

P.S. Finalizer code
 this._webSocketServer?.Dispose();

comments