public static ClientProcessor GetInstance(IPAddress ip, int port, ScreenProcessor sProcessor) { if (_instance == null) { _instance = new ClientProcessor(ip, port, sProcessor); } return _instance; }
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)); } }
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(); }
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; }