Ejemplo n.º 1
0
 public void Reset()
 {
     ReadError   = 0;
     SendError   = 0;
     BytesSent   = 0;
     BitesRev    = 0;
     PacketsSend = 0;
     PacketsRec  = 0;
     stage       = PerStage.NotConnected;
 }
Ejemplo n.º 2
0
 public void Disconnect()
 {
     stage = PerStage.NotConnected;
     try
     {
         if (m_socket != null)
         {
             m_socket.Close();
         }
     }
     catch { }
     if (isClient)
     {
         JHSNetworkClient.Disconnect(this);
     }
     else
     {
         JHSNetworkServer.Disconnect(this);
     }
 }
Ejemplo n.º 3
0
        public void StartReceiving(Socket socket)
        {
            if (socket != null)
            {
                m_socket = socket;
            }

            if (m_socket != null && m_socket.Connected)
            {
                stage       = PerStage.Verifying;
                tcpEndPoint = (IPEndPoint)m_socket.RemoteEndPoint;
                try
                {
                    m_socket.BeginReceive(m_Connbuffer, 0, m_Connbuffer.Length, SocketFlags.None, asyncrec, null);
                }
                catch
                {
                    Disconnect();
                }
            }
        }