private void StartToListen() { AsyncTCPListener mListener = new AsyncTCPListener(new WebListenerConfig() { Port = 8008, MaxBufferSize = 10 * 1024 * 1024, MaxConnection = 1000, BackLog = 100 }); /* ---------- TCP LISTENER TEST S ----------- */ //WebListenerTester tester = new WebListenerTester(mListener); /* ---------- TCP LISTENER TEST E ----------- */ /* ---------- WEBSOCKET SERVER S ------------ */ WebsocketServer mWebsocketServer = new WebsocketServer(mListener); //IWebsocketSubProtocol mSub1 = new (); //mWebsocketServer.addSubProtocol(mSub1); /* ---------- WEBSOCKET SERVER E ------------ */ /* ---------- HTTP PROXY S ------------------ */ //proxy server goes here /* ---------- HTTP PROXY E ------------------ */ mListener.Start(); }
public WebsocketServer(AsyncTCPListener listener) { mSubProtocols = new List<IWebsocketSubprotocol>(); mClients = new Dictionary<string, WebClient>(); mHandShaker = new WebsocketImplS.HandShaker(); mDataParse = new WebsocketImplS.DataParser(); mSendTokenIds = new List<int>(); mTcpListener = listener; mTcpListener.AddHandler(this); }
//public void start() //{ // mTokenIds = new List<int>(); // mListener = new AsyncTCPListener(new WebListenerConfig() // { // Port=8008, // MaxBufferSize=10*1024*1024, // MaxConnection=10000, // BackLog=100 // }); // mListener.AddHandler(this); // mListener.Start(); //} public WebListenerTester(AsyncTCPListener listener) { mTokenIds = new List<int>(); mListener = listener; mListener.AddHandler(this); }