FECipherVit.Connection.Disconnect C# (CSharp) Méthode

Disconnect() public méthode

public Disconnect ( ) : void
Résultat void
        public void Disconnect()
        {
            buttonConnect.Enabled = true;
            buttonWaitConnect.Enabled = true;
            button_Disconnect.Enabled = false;
            button_Confirm.Enabled = true;
            textBoxIP.Enabled = true;
            textBox_UserName.Enabled = true;
            textBox_Port.Enabled = true;
            textBox_RivalPort.Enabled = true;
            if (Owner.Language == Language.Chinese)
            {
                labelConnectStatus.Text = "未连接";
            }
            else
            {
                labelConnectStatus.Text = "Without connection.";
            }
            Owner.msgProcessor.RcvBuf = "";
            Portusing = -1;
            Owner.RivalConnected = false;
            if (Owner.MyAccessCharacter == AccessCharater.Host)
            {
                if (Owner.socket != null)
                {
                    ServerSocket temp = (ServerSocket)Owner.socket;
                    foreach (Socket communicateSocket in temp.communicateSockets)
                    {
                        if (communicateSocket != null)
                        {
                            communicateSocket.Shutdown(System.Net.Sockets.SocketShutdown.Both);
                            communicateSocket.Close();
                        }
                    }
                }
            }
            else
            {
                if (Owner.socket != null)
                {
                    if (Owner.socket.communicateSocket != null)
                    {
                        try
                        {
                            Owner.socket.communicateSocket.Shutdown(System.Net.Sockets.SocketShutdown.Both);
                        }
                        catch { }
                        Owner.socket.communicateSocket.Close();
                        Owner.socket.communicateSocket = null;
                    }
                }
            }
            Owner.socket = null;
            connected = false;
            Owner.EverReceived = false;
            Owner.OccupyCount = 0;
            Owner.MyAccessCharacter = AccessCharater.Host;
            if (Owner.WatchingMode)
            {
                Owner.UnSetWatchingMode();
            }
        }

Same methods

Connection::Disconnect ( Socket communicateSocket ) : void