Beispiel #1
0
 public static ClientProcessor GetInstance(IPAddress ip, int port, ScreenProcessor sProcessor)
 {
     if (_instance == null)
     {
         _instance = new ClientProcessor(ip, port, sProcessor);
     }
     return _instance;
 }
Beispiel #2
0
 public frmServer()
 {
     InitializeComponent();
     this._screenProcessor = ScreenProcessor.Instance;
     IPAddress ip = IPAddress.Parse("192.168.1.100");
     this._clientProcessor = ClientProcessor.GetInstance(ip, 21999, this._screenProcessor);
     using (Graphics g = this.pnScreen.CreateGraphics())
     {
         this._bg = BufferedGraphicsManager.Current.Allocate(g, new Rectangle(0, 0, this.pnScreen.Width, this.pnScreen.Height));
     }
     
 }
Beispiel #3
0
        private bool _compress = false;                         //Применять ли Zip сжатие к передоваемым данным

        #endregion
        
        #region PUBLIC METHODS

        public ClientExchanger(TcpClient client, ScreenProcessor sProcessor)
        {
            if (client == null)
            {
                Debug.WriteLine("Необходимо передать TcpClient для создания объекта");
                throw new ClientExchangerException("TcpClient ip is null");
            }
            if (sProcessor == null)
            {
                Debug.WriteLine("Необходимо передать ScreenProcessor для создания объекта");
                throw new ClientExchangerException("ScreenProcessor sProcessor is null");
            }

            this._client = client;
            this._screenProcessor = sProcessor;
            this._clientAddress = client.Client.RemoteEndPoint.ToString();
        }
Beispiel #4
0
        private ClientProcessor(IPAddress ip, int port, ScreenProcessor sProcessor)
        {
            if (port <= 0 || port > 65536)
            {
                Debug.WriteLine("Недопустимое значение порта (port = )" + port);
                throw new ClientProcessorException("Недопустимое значение порта (port = )" + port);
            }
            if (ip == null)
            {
                Debug.WriteLine("Необходимо передать IPAddress для создания объекта");
                throw new ClientProcessorException("IPAddress ip is null");
            }
            if (sProcessor == null)
            {
                Debug.WriteLine("Необходимо передать ScreenProcessor для создания объекта");
                throw new ClientProcessorException("ScreenProcessor sProcessor is null");
            }

            this._serverAddress = ip;
            this._serverPort = port;
            this._screenProcessor = sProcessor;
        }