/// <summary> /// 소켓 연결 종료를 처리하는 콜백 함수 /// </summary> /// <param name="ar"></param> private void OnCloseCallBack(IAsyncResult ar) { try { Socket client = (Socket)ar.AsyncState; client.EndDisconnect(ar); client.Close(); AsyncSocketConnectionEventArgs cev = new AsyncSocketConnectionEventArgs(this.id); Closed(cev); } catch (System.Exception e) { AsyncSocketErrorEventArgs eev = new AsyncSocketErrorEventArgs(this.id, e); ErrorOccured(eev); } }
private void OnClose(object sender, AsyncSocketConnectionEventArgs e) { LogManager.Instance.Log(string.Format("private void OnClose {0}/{1}", sender.ToString(), e.ToString())); }
private void OnConnet(object sender, AsyncSocketConnectionEventArgs e) { K_TO_M_CHANNEL_IDX p = new K_TO_M_CHANNEL_IDX(); p.num = (byte)PACKET_IDX.KM_CHANNEL_IDX; p.len = (Int16)Marshal.SizeOf(p); p.nIdx = crawleridx_; byte[] sendbuffer = new byte[p.len]; PacketProcess.Serialize(p, sendbuffer); ((AsyncSocketClient)sender).Send(sendbuffer); }
private void OnClose(object sender, AsyncSocketConnectionEventArgs e) { LogManager.Instance.Log("private void OnClose(object sender, AsyncSocketConnectionEventArgs e)"); }
private void OnConnet(object sender, AsyncSocketConnectionEventArgs e) { LogManager.Instance.Log("private void OnConnet(object sender, AsyncSocketConnectionEventArgs e)"); LQCrawlerInfo pInfo = CrawlerManager.Instance.GetCrawlerInfo(); C_TO_M_CHANNEL_IDX p = new C_TO_M_CHANNEL_IDX(); p.num = (byte)PACKET_IDX.CM_CHANNEL_IDX; p.len = (Int16)Marshal.SizeOf(p); //p.nIdx = CrawlerInfoManager.Instance.channelidx_; p.nIdx = pInfo.nIdx_; byte[] sendbuffer = new byte[p.len]; PacketProcess.Serialize(p, sendbuffer); ((AsyncSocketClient)sender).Send(sendbuffer); }
private void OnConnet(object sender, AsyncSocketConnectionEventArgs e) { NewLogManager2.Instance.Log("연결 되었어요"); }
private void OnClose(object sender, AsyncSocketConnectionEventArgs e) { }
/// <summary> /// 연결 요청 처리 콜백 함수 /// </summary> /// <param name="ar"></param> private void OnConnectCallback(IAsyncResult ar) { try { Socket client = (Socket)ar.AsyncState; // 보류 중인 연결을 완성한다. client.EndConnect(ar); conn = client; // 연결에 성공하였다면, 데이터 수신을 대기한다. Receive(); // 연결 성공 이벤트를 날린다. AsyncSocketConnectionEventArgs cev = new AsyncSocketConnectionEventArgs(this.id); Connected(cev); } catch (System.Exception e) { AsyncSocketErrorEventArgs eev = new AsyncSocketErrorEventArgs(this.id, e); ErrorOccured(eev); } }
protected virtual void Connected(AsyncSocketConnectionEventArgs e) { AsyncSocketConnectEventHandler handler = OnConnet; if (handler != null) handler(this, e); }