예제 #1
0
        private void _handleDisconnection(IPEndPoint endpoint)
        {
            _connections[endpoint].StopSendLoop();
            _connections.Remove(endpoint);

            Disconnection?.Invoke(endpoint);
        }
예제 #2
0
 public void DisconnectClient()
 {
     socket.Close();
     stream.Dispose();
     socket.Dispose();
     Disconnection?.Invoke();
 }
예제 #3
0
        public void Disconnect()
        {
            if (!m_bConnect)
            {
                return;
            }

            //서버에도 연결을 끊었다는 신호를 보내주어야 한다.
            Disconnection ds = new Disconnection();

            ds.Type = (int)PacketType.EXIT;
            Packet.Serialize(ds).CopyTo(this.sendBuffer, 0);
            Send();

            m_bConnect = false;
            m_Client.Close();
            m_Stream.Flush();
            m_Stream.Close();

            lvwFiles.Clear();
            trvDir.Nodes.Clear();
            btnServerConnect.Text      = "서버연결";
            btnServerConnect.ForeColor = Color.Black;
            //Message("상대방과 연결 중단");
        }
        private void CloseClientSocket(NetConnection connection)
        {
            try
            {
                connection.Socket.Close(CloseTimeout);
            }
            catch (Exception) // throws if client process has already closed
            {
            }

            Disconnection?.Invoke(this, connection);
        }
예제 #5
0
        public void CloseConnection(IPEndPoint endpoint)
        {
            if (!_connections.ContainsKey(endpoint))
            {
                throw new InvalidOperationException("Client is not connected");
            }

            Send(new[] { (byte)MessageIdentifiers.DisconnectionNotification }, endpoint);

            _connections[endpoint].StopSendLoop();
            _connections.Remove(endpoint);

            Disconnection?.Invoke(endpoint);
        }
예제 #6
0
 internal void RaiseDisconnection(string reason)
 {
     Disconnection?.Invoke(this, reason);
 }
예제 #7
0
 // Token: 0x0600001B RID: 27 RVA: 0x000024CE File Offset: 0x000006CE
 internal void CloseCallback(ServerClient client)
 {
     clients.Remove(client);
     Disconnection?.Invoke(client);
 }
예제 #8
0
 public void SetDCHandler(Disconnection Method)
 {
     DCHandler = Method;
 }
예제 #9
0
 // Token: 0x0600000E RID: 14 RVA: 0x0000228E File Offset: 0x0000048E
 private void CloseCallback(object sender, CloseEventArgs e)
 {
     Disconnection?.Invoke();
 }