/// <summary> /// Called when [connect]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="SocketAsyncEventArgs"/> instance containing the event data.</param> private void OnConnect(object sender, SocketAsyncEventArgs e) { if (e.SocketError == SocketError.Success) { TCPSession tcpSession = e.UserToken as TCPSession; tcpSession.OnConnectCompleted(mSocket); if (this.mConnectedCallback != null) { this.mConnectedCallback(tcpSession); } tcpSession.OnConnect(); tcpSession.ReceiveRequest(); } else { // 연결 끊김 if (this.mConnectedFailCallback != null) { this.mConnectedFailCallback(); } } }