public XFetchVersionNetwork() { this.m_oSocket = null; this.m_nState = XFetchVersionNetwork.SocketState.State_Closed; XFetchVersionNetwork.m_oRecvBuff = null; this.m_nCurrRecvLen = 0; this.m_RecvCb = new AsyncCallback(this.RecvCallback); this.m_ConnectCb = new AsyncCallback(this.OnConnect); }
public void Close() { this.m_nState = XFetchVersionNetwork.SocketState.State_Closed; if (this.m_oSocket == null) { return; } try { this.m_oSocket.Close(); } catch (Exception ex) { XSingleton <XDebug> .singleton.AddWarningLog(ex.Message, null, null, null, null, null); } this.m_oSocket = null; }
public bool Init() { this.GetNetworkType(); try { this.m_nState = XFetchVersionNetwork.SocketState.State_Closed; this.m_oSocket = new Socket(this.m_NetworkType, SocketType.Stream, ProtocolType.Tcp); this.m_oSocket.NoDelay = true; if (XFetchVersionNetwork.m_oRecvBuff == null) { XFetchVersionNetwork.m_oRecvBuff = new byte[512]; } this.m_nCurrRecvLen = 0; } catch (Exception ex) { XSingleton <XDebug> .singleton.AddWarningLog(ex.Message, "new Socket Error!", null, null, null, null); return(false); } return(true); }
private void SetState(XFetchVersionNetwork.SocketState nState) { this.m_nState = nState; }