Beispiel #1
0
 static void Main(string[] args)
 {
     server = new SOCKET.Server("127.0.0.1", 6546);
     server.Listen();
     server.StartReceiveAsync(OnConnectionAcept);
     while (true)
     {
         try
         {
             Remote.NetworkStream ns = new Remote.NetworkStream("127.0.0.1", 6547, Remote.NetworkStream.Type.Server);
             Console.WriteLine("Test server running");
         }
         catch
         {
             Console.Clear();
             Remote.NetworkStream ns = new Remote.NetworkStream("127.0.0.1", 6547, Remote.NetworkStream.Type.Client);
             Console.WriteLine("Test client running");
             byte[] arr = new byte[1016 * 295000 + 50];
             ns.SendSimple(arr);
         }
         string   input = Console.ReadLine();
         string[] words = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
         ProcessInput(ref words);
         continue;
     }
 }
Beispiel #2
0
        private void ServerStartButton_Click(object sender, RoutedEventArgs e)
        {
            if (server.socket != null)
            {
                server.Close();
                ServerStartButton.Content = Remote.Language.Find(off => ServerStartButton.Content, this, "Start Server");
                //ServerStartButton.Content = "Start Server";
            }
            else
            {
                server = new SOCKET.Server(Settings.s.remoteDesktopPort);
                if (server.Listen())
                {
                    server.StartReceiveAsync(OnConnectionAccept);
                    ServerStartButton.Content = Remote.Language.Find(on => ServerStartButton.Content, this, "Stop Server");
                    //ServerStartButton.Content = "Stop Server";
                }
            }

            //cw.WriteLine(Remote.Language.Find(() => ServerStartButton.Content, this, ""));
        }
Beispiel #3
0
        //[System.Runtime.InteropServices.DllImport("gdi32.dll")]
        //public static extern bool DeleteObject(IntPtr hObject);
        public MainWindow()
        {
            InitializeComponent();
            Loaded  += MainWindow_Loaded;
            Closing += MainWindow_Closing;

            FlyoutsControlAll.Visibility = System.Windows.Visibility.Visible;
            ConnectedInfo.Visibility     = System.Windows.Visibility.Hidden;

            ScreenCaptureMethodComboBox.ItemsSource = screenCaptureMethods;
            BufferingComboBox.ItemsSource           = Remote.Language.Find(() => BufferingComboBox.ItemsSource, this, frameBufferings);       //frameBufferings;
            CompositionComboBox.ItemsSource         = Remote.Language.Find(() => CompositionComboBox.ItemsSource, this, desktopCompositions); //desktopCompositions;
            FormatComboBox.ItemsSource          = pixelFormats;
            FPSComboBox.ItemsSource             = framesPerSeconds;
            CompressionComboBox.ItemsSource     = Remote.Language.Find(() => CompressionComboBox.ItemsSource, this, compressions);        //compressions;
            CodecComboBox.ItemsSource           = losslessCodec;
            LZ4BlockSizeComboBox.ItemsSource    = LZ4BlockSizes;
            AutoStartServerComboBox.ItemsSource = Remote.Language.Find(() => AutoStartServerComboBox.ItemsSource, this, autoStartServer);;

            Bind(ScreenCaptureMethodComboBox.Name, () => Settings.s.remoteDesktopSettings.screenCaptureMethod, true);
            Bind(BufferingComboBox.Name, () => Settings.s.remoteDesktopSettings.frameBuffering, true);
            Bind(CompositionComboBox.Name, () => Settings.s.remoteDesktopSettings.desktopComposition, true);
            Bind(FormatComboBox.Name, () => Settings.s.remoteDesktopSettings.pixelFormat, true);
            Bind(FPSComboBox.Name, () => Settings.s.remoteDesktopSettings.framesPerSecond, true);
            Bind(CompressionComboBox.Name, () => Settings.s.remoteDesktopSettings.compression, true);
            Bind(LZ4BlockSizeComboBox.Name, () => Settings.s.remoteDesktopSettings.LZ4BlockSize, true);
            Bind(AutoStartServerComboBox.Name, () => Settings.s.startServer, false);

            ScreenCaptureMethodComboBox.SelectedIndex = Settings.s.remoteDesktopSettings.screenCaptureMethod;
            BufferingComboBox.SelectedIndex           = Settings.s.remoteDesktopSettings.frameBuffering;
            CompositionComboBox.SelectedIndex         = Settings.s.remoteDesktopSettings.desktopComposition;
            FormatComboBox.SelectedIndex      = Settings.s.remoteDesktopSettings.pixelFormat;
            FPSComboBox.SelectedIndex         = Settings.s.remoteDesktopSettings.framesPerSecond;
            CompressionComboBox.SelectedIndex = Settings.s.remoteDesktopSettings.compression;
            if (CompressionComboBox.SelectedIndex == 0)
            {
                //Bind(CodecComboBox.Name, () => Settings.s.remoteDesktopSettings.losslessCodec);
                // Notes: No need to bind here, as this will be changed in custom method and not in generic one!
                CodecComboBox.SelectedIndex = Settings.s.remoteDesktopSettings.losslessCodec;
            }
            else
            {
                //Bind(CodecComboBox.Name, () => Settings.s.remoteDesktopSettings.lossyCodec);
                // Notes: No need to bind here, as this will be changed in custom method and not in generic one!
                CodecComboBox.SelectedIndex = Settings.s.remoteDesktopSettings.lossyCodec;
            }
            LZ4BlockSizeComboBox.SelectedIndex = Settings.s.remoteDesktopSettings.LZ4BlockSize;


            Address.ItemsSource = Settings.s.addresses;

            if (Settings.s.startServer == 1)
            {
                server = new SOCKET.Server(Settings.s.remoteDesktopPort);
                server.Listen();
                server.StartReceiveAsync(OnConnectionAccept);
                ServerStartButton.Content = Remote.Language.Find(on => ServerStartButton.Content, this, "");
                //ServerStartButton.Content = "Stop Server";
            }
            else
            {
                server = new SOCKET.Server(Settings.s.remoteDesktopPort);
                server.Close();
                ServerStartButton.Content = Remote.Language.Find(off => ServerStartButton.Content, this, "");
                //ServerStartButton.Content = "Start Server";
            }

            UserNameTextBox.Text = Settings.s.name;
            PortTextBox.Text     = Settings.s.remoteDesktopPort.ToString();

            //lServer.Content = Remote.Language.Find(() => lServer.Content, this, "Server");
            //cw.WriteLine(lServer.Name);

            //Screen.EnableComposition(false);
            sw = new Stopwatch();
            sw.Start();
            dt          = new DispatcherTimer(DispatcherPriority.Send);
            dt.Tick    += dt_Tick;
            dt.Interval = new TimeSpan(0, 0, 0, 0, /*1000 / fps*/ 40);
            oldTick     = Environment.TickCount;
            dt.Start();

            /*Thread thread = new Thread(dt_Tick1);
             * thread.Priority = ThreadPriority.Highest;
             * thread.Start();*/

            /*Thread thread1 = new Thread(dt_Tick1);
             * thread1.Priority = ThreadPriority.Highest;
             * thread1.Start();*/

            /*Thread thread2 = new Thread(dt_Tick1);
             * thread2.Priority = ThreadPriority.Highest;
             * thread2.Start();*/
        }