Пример #1
0
 private void frmClient_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (client != null)
     {
         client.Destroy();
     }
 }
Пример #2
0
        public bool ReConnect(String sIP, int nPort)
        {
            if (m_TcpClient != null)
            {
                m_TcpClient.Destroy();
            }

            m_TcpClient = new HPSocketCS.TcpClient();
            m_TcpClient.OnPrepareConnect += new TcpClientEvent.OnPrepareConnectEventHandler(OnPrepareConnect);
            m_TcpClient.OnConnect        += new TcpClientEvent.OnConnectEventHandler(OnConnect);
            m_TcpClient.OnSend           += new TcpClientEvent.OnSendEventHandler(OnSend);
            m_TcpClient.OnReceive        += new TcpClientEvent.OnReceiveEventHandler(OnReceive);
            m_TcpClient.OnClose          += new TcpClientEvent.OnCloseEventHandler(OnClose);

            m_Queue.Clear();
            m_TempQueue.Clear();
            this.m_sIP   = sIP;
            this.m_nPort = (ushort)nPort;
            return(this.Connect(true));
        }
Пример #3
0
 private void FrmMain_FormClosed(object sender, FormClosedEventArgs e)
 {
     client.Destroy();
 }