示例#1
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;
        }
示例#2
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();
        }
示例#3
0
 private void StartServer(int port)
 {
     server.Start(port);
     ServerStartButton.Invoke(new Action(() => { ServerStartButton.Text = "Stop server";
                                                 ClientSettingsPanel.Show();
                                                 selectedClient = GetlocalhostInfo();
                                                 ClientListBox.Show();
                                                 UpdateClientList();
                                                 RedrawClientSettings();
                                                 ReadServerSettings(); }));
 }
示例#4
0
        private static void Cmd_Start(string arg1)
        {
            if (server.Running)
            {
                Console.WriteLine("Server already running");
                return;
            }

            int.TryParse(arg1, out int port);

            if (port < 1 || port > 65535)
            {
                Console.WriteLine("Invalid port");
                return;
            }

            server.Start(port);
        }
示例#5
0
        public void StartServer(int port, ISServerStartOptionsModel options)
        {
            List <string> o = new List <string>();

            if (!options.EnableClipboard)
            {
                o.Add("noclipboard");
            }
            if (!options.EnableDragDrop)
            {
                o.Add("nodragdrop");
            }
            if (!options.EnableUdp)
            {
                o.Add("noudp");
            }

            serverInstance.Start(GetPlatformDependencies(), new StartOptions(o), port);
        }