private void ProcessAccept(SocketAsyncEventArgs accpetEventArg) { SaeaConnectState connectState = connectStatePool.Get(); connectState.ReadComplete += ConnectState_ReadComplete; connectState.SendComplete += ConnectState_SendComplete; connectState.DisconnectEvent += ConnectState_DisconnectEvent; SocketAsyncEventArgs readWiteEventArg = connectState.SocketArg; readWiteEventArg.SetBuffer(new byte[readCacheSize], 0, readCacheSize); readWiteEventArg.UserToken = new AsyncUserToken { AcceptSocket = accpetEventArg.AcceptSocket }; accpetEventArg.AcceptSocket.ReceiveAsync(readWiteEventArg); log.NormalLog(string.Format("connect information,ReceiveAsync Start,ID:{0} , IPAdderss:{1}", connectState.ID, accpetEventArg.AcceptSocket.RemoteEndPoint)); //Accept Next; startAccept(accpetEventArg); }
private void ConnectState_ReadComplete(SaeaConnectState obj) { ReadComplete?.Invoke(obj); }
private void ConnectState_SendComplete(SaeaConnectState obj) { SendComplete?.Invoke(obj); }
private void ConnectState_DisconnectEvent(SaeaConnectState obj) { DisconnectEvent?.Invoke(obj); }