Ejemplo n.º 1
0
        public TCPServer(ContestPresenter contest)
        {
            LANServer = contest.window.LAN;


            if (LANServer)
            {
                serverIp = GetInternalIP();
            }
            else
            {
                serverIp = GetPublicIP();
                port     = contest.window.Port;
                // the port will also need to be opened for the server
            }

            contestPresenter = contest;

            HostInfo = contestPresenter.CurrentContest.Info.Name + ":" + serverIp.ToString();

            // kallar Instance()
            server = this;

            Credentials = new NetworkCredential("oskarsandh", "simmalungt1");

            threadServer = new Thread(server.ThreadListener);
            threadServer.IsBackground = true;
            threadServer.Start();
        }
        /// <summary>
        /// Move on to the ContestView
        /// </summary>
        private void FinalizeContest()
        {
            ContestView      contestView      = new ContestView();
            ContestPresenter contestPresenter = new ContestPresenter(contestView, window, CurrentContest);

            window.ChangePanel(contestView, View);
        }
Ejemplo n.º 3
0
 public static TCPServer Instance(ContestPresenter contest)
 {
     if (server == null)
     {
         server = new TCPServer(contest);
     }
     return(server);
 }
Ejemplo n.º 4
0
        public HandleClient(TCPServer server, TcpClient client, ContestPresenter contest)
        {
            this.contestPresenter = contest;
            this.Server           = server;
            this.Client           = client;
            ClientName            = "";

            ThreadClient = new Thread(ClientThread);
            ThreadClient.IsBackground = true;
            ThreadClient.Name         = "Client ";
            ThreadClient.Start();
        }