public TCPConnection(TCPRole role, IPAddress serverIP, int serverPort)
        {
            switch (role)
            {
            case TCPRole.Server:
                try
                {
                    this.ServerRef = new Server(serverPort);
                    this.ServerRef.Start();
                }
                catch (FormatException e)
                {
                    Console.WriteLine("Unexceped exception occured: " + e);
                }

                break;

            case TCPRole.Client:
                try
                {
                    this.ClientRef = new ClientThread(this, serverIP, serverPort);
                    this.ClientRef.Start();
                }
                catch (FormatException e)
                {
                    Console.WriteLine("Unexceped exception occured: " + e);
                }
                break;

            default:
                // The current settings don't match for using a tcp connection.
                // This application is used as desktop client of MISD.
                break;
            }
        }
示例#2
0
 public NetworkStatus(ConnectionStatus connectionStatus, ConnectionProtocolType protocolType, TCPRole tcpRole, int clientCount, string classroomName)
 {
     this.ConnectionStatus = connectionStatus;
     this.ProtocolType     = protocolType;
     this.TCPRole          = tcpRole;
     this.ClientCount      = clientCount;
     this.ClassroomName    = classroomName;
 }
示例#3
0
 public NetworkStatus(ConnectionStatus connectionStatus, ConnectionProtocolType protocolType, TCPRole tcpRole, int clientCount, string classroomName)
 {
     this.ConnectionStatus = connectionStatus;
     this.ProtocolType = protocolType;
     this.TCPRole = tcpRole;
     this.ClientCount = clientCount;
     this.ClassroomName = classroomName;
 }
示例#4
0
 public NetworkStatus(ConnectionStatus connectionStatus, ConnectionProtocolType protocolType, TCPRole tcpRole, int clientCount)
     : this(connectionStatus, protocolType, tcpRole, clientCount, "")
 {
 }
示例#5
0
 public NetworkStatus(ConnectionStatus connectionStatus, ConnectionProtocolType protocolType, TCPRole tcpRole, int clientCount)
     : this(connectionStatus, protocolType, tcpRole, clientCount, "")
 {
 }