Esempio n. 1
0
 public LoginServer(ILogger <LoginServer> logger, LoginConfiguration loginConfiguration)
     : base(new ServerConfiguration(loginConfiguration.Host, loginConfiguration.Port, loginConfiguration.MaximumNumberOfConnections))
 {
     this.logger             = logger;
     this.loginConfiguration = loginConfiguration;
     this.InterServer        = new ISServer(loginConfiguration.InterServerConfiguration);
 }
Esempio n. 2
0
        public static void Run()
        {
            Console.Clear();

            int port = 0;

            do
            {
                Console.WriteLine("Enter port to start server: (blank for 4441)");
                string pStr = Console.ReadLine();

                if (string.IsNullOrEmpty(pStr))
                {
                    port = 4441;
                }
                else
                {
                    int.TryParse(pStr, out port);
                }
                Console.Clear();
            } while (port < 1 || port > 65535);


            Console.Clear();

            server = new ISServer(WindowsDependencies.GetServerDependencies());
            server.ClientConnected     += Server_ClientConnected;
            server.ClientDisconnected  += Server_ClientDisconnected;
            server.InputClientSwitched += Server_InputClientSwitched;
            server.Started             += Server_Started;
            server.Stopped             += Server_Stopped;
            try
            {
                server.Start(port);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failed to start server: " + ex.Message);
            }

            PrintHelp();
            Thread.Sleep(250);

            while (server.Running)
            {
                ExecCmd(Console.ReadLine());
            }

            Thread.Sleep(1000);
            Console.Write(".");
            Thread.Sleep(1000);
            Console.Write(".");
            Thread.Sleep(1000);
            Console.Write(".");
            Thread.Sleep(1000);
            return;
        }
Esempio n. 3
0
        protected void StartCommunication()
        {
            ClientHandler client = new ClientHandler(controller, logging);

            server = new ISServer(8000, logging, client);
            ImageServer.NotifyAllHandlerRemoved += server.NotifyAllClientsAboutUpdate;
            logging.UpdateLogs += server.NotifyAllClientsAboutUpdate;
            server.Start();
        }
Esempio n. 4
0
 public MainForm()
 {
     this.FormClosing += MainForm_FormClosing;
     this.FormClosed  += MainForm_FormClosed;
     this.Resize      += MainForm_Resize;
     InitializeComponent();
     server = new ISServer();
     cForm  = new ClientForm(this);
 }
Esempio n. 5
0
 internal ISServerModel()
 {
     serverInstance                      = new ISServer();
     serverInstance.Started             += ServerInstance_Started;
     serverInstance.Stopped             += ServerInstance_Stopped;
     serverInstance.ClientConnected     += (object o, ISClientInfoModel c) => ClientConnected?.Invoke(c);
     serverInstance.ClientDisconnected  += (object o, ISClientInfoModel c) => ClientDisconnected?.Invoke(c);
     serverInstance.InputClientSwitched += (object o, ISClientInfoModel c) => InputClientSwitched?.Invoke(c);
 }