Ejemplo n.º 1
0
        private void ProcessAccept(object sender, SocketAsyncEventArgs e)
        {
            Socket s = e.AcceptSocket;

            mClientSocketsPool.Add(s);

            Select_Token        mClient       = new Client_Select();
            ArraySegment <byte> mSendBuffer   = new ArraySegment <byte> ();
            ArraySegment <byte> mReceieBuffer = new ArraySegment <byte> ();

            mBufferManager.SetBuffer(ref mSendBuffer);
            mBufferManager.SetBuffer(ref mReceieBuffer);
            mClient.init(s, mSendBuffer, mReceieBuffer);
            mDicToken [s] = (Client_Select)mClient;

            string outStr = String.Format("客户 {0} 连入, 共有 {1} 个连接。", s.RemoteEndPoint.ToString(), this.m_numConnectedSockets);

            DebugSystem.Log(outStr);

            ClientFactory_Select.Instance.AddClient((Client_Select)mClient);

            this.StartAccept(e);
        }
Ejemplo n.º 2
0
 public void AddClient(Client_Select client)
 {
     mClientPool[client.getId()] = client;
 }