Exemple #1
0
        /// <summary>
        /// Attempt to connect to a remote VNC Host.
        /// </summary>
        /// <param name="host">The IP Address or Host Name of the VNC Host.</param>
        /// <param name="port">The Port number on which to connect.  Usually this will be 5900, except in the case that the VNC Host is running on a different Display, in which case the Display number should be added to 5900 to determine the correct port.</param>
        public void Connect(string host, int port)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            // Try to connect, passing any exceptions up to the caller, and if successful,
            // wrap a big endian Binary Reader and Binary Writer around the resulting stream.
            tcp = new TcpClient {
                NoDelay = true
            };                                             // turn-off Nagle's Algorithm for better interactive performance with host.

            tcp.ReceiveTimeout = RECEIVE_TIMEOUT;          // set receive timeout (15s default)
            tcp.SendTimeout    = SEND_TIMEOUT;             // set send timeout to (15s default)
            tcp.Connect(host, port);
            stream = tcp.GetStream();

            stream.ReadTimeout  = RECEIVE_TIMEOUT;         // set read timeout to (15s default)
            stream.WriteTimeout = SEND_TIMEOUT;            // set write timeout to (15s default)

            // Most of the RFB protocol uses Big-Endian byte order, while
            // .NET uses Little-Endian. These wrappers convert between the
            // two.  See BigEndianReader and BigEndianWriter below for more details.
            Reader     = new BigEndianBinaryReader(stream);
            writer     = new BigEndianBinaryWriter(stream);
            ZrleReader = new ZRLECompressedReader(stream);
        }
Exemple #2
0
        /// <summary>
        /// Attempt to connect to a remote VNC Host.
        /// </summary>
        /// <param name="host">The IP Address or Host Name of the VNC Host.</param>
        /// <param name="port">The Port number on which to connect.  Usually this will be 5900, except in the case that the VNC Host is running on a different Display, in which case the Display number should be added to 5900 to determine the correct port.</param>
        public void Connect(string host, int port)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            // Try to connect, passing any exceptions up to the caller, and if successful,
            // wrap a big endian Binary Reader and Binary Writer around the resulting stream.
            tcp         = new TcpClient();
            tcp.NoDelay = true;

            // turn-off Nagle's Algorithm for better interactive performance with host.
            //need to tell unity to let me use the port im about to use


            tcp.Connect(host, port);
            stream = tcp.GetStream();

            // Most of the RFB protocol uses Big-Endian byte order, while
            // .NET uses Little-Endian. These wrappers convert between the
            // two.  See BigEndianReader and BigEndianWriter below for more details.
            reader     = new BigEndianBinaryReader(stream);
            writer     = new BigEndianBinaryWriter(stream);
            zrleReader = new ZRLECompressedReader(stream);
        }
Exemple #3
0
        /// <summary>
        /// Set Streams to valiables.
        /// </summary>
        private void SetStreams()
        {
            stream = tcpClient.GetStream();

            // Most of the RFB protocol uses Big-Endian byte order, while
            // .NET uses Little-Endian. These wrappers convert between the
            // two.  See BigEndianReader and BigEndianWriter below for more details.
            reader     = new BigEndianBinaryReader(stream);
            writer     = new BigEndianBinaryWriter(stream);
            zrleReader = new ZRLECompressedReader(stream);
        }
Exemple #4
0
        public void Connect(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            stream.ReadTimeout  = RECEIVE_TIMEOUT;         // set read timeout to (15s default)
            stream.WriteTimeout = SEND_TIMEOUT;            // set write timeout to (15s default)

            // Most of the RFB protocol uses Big-Endian byte order, while
            // .NET uses Little-Endian. These wrappers convert between the
            // two.  See BigEndianReader and BigEndianWriter below for more details.
            Reader     = new BigEndianBinaryReader(stream);
            writer     = new BigEndianBinaryWriter(stream);
            ZrleReader = new ZRLECompressedReader(stream);
        }
Exemple #5
0
        /// <summary>
        /// Attempt to connect to a remote VNC Host.
        /// </summary>
        /// <param name="host">The IP Address or Host Name of the VNC Host.</param>
        /// <param name="port">The Port number on which to connect.  Usually this will be 5900, except in the case that the VNC Host is running on a different Display, in which case the Display number should be added to 5900 to determine the correct port.</param>
        public void Connect(string host, int port)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            // Try to connect, passing any exceptions up to the caller, and if successful,
            // wrap a big endian Binary Reader and Binary Writer around the resulting stream.
            stream = CreateNewCommunicationChannel(host, port);

            // Most of the RFB protocol uses Big-Endian byte order, while
            // .NET uses Little-Endian. These wrappers convert between the
            // two.  See BigEndianReader and BigEndianWriter below for more details.
            reader     = new BigEndianBinaryReader(stream);
            writer     = new BigEndianBinaryWriter(stream);
            zrleReader = new ZRLECompressedReader(stream);
        }
Exemple #6
0
		/// <summary>
		/// Attempt to connect to a remote VNC Host.
		/// </summary>
		/// <param name="host">The IP Address or Host Name of the VNC Host.</param>
		/// <param name="port">The Port number on which to connect.  Usually this will be 5900, except in the case that the VNC Host is running on a different Display, in which case the Display number should be added to 5900 to determine the correct port.</param>
		public void Connect(string host, int port)
		{
			if (host == null) throw new ArgumentNullException("host");

			// Try to connect, passing any exceptions up to the caller, and if successful, 
			// wrap a big endian Binary Reader and Binary Writer around the resulting stream.
			tcp = new TcpClient();
			tcp.NoDelay = true;  // turn-off Nagle's Algorithm for better interactive performance with host.
						
			tcp.Connect(host, port);
			stream = tcp.GetStream();

			// Most of the RFB protocol uses Big-Endian byte order, while
			// .NET uses Little-Endian. These wrappers convert between the
			// two.  See BigEndianReader and BigEndianWriter below for more details.
			reader = new BigEndianBinaryReader(stream);
			writer = new BigEndianBinaryWriter(stream);
			zrleReader = new ZRLECompressedReader(stream);
		}
Exemple #7
0
        /// <summary>
        /// Set Streams to valiables.
        /// </summary>
        private void SetStreams()
        {
            stream = tcpClient.GetStream();

            // Most of the RFB protocol uses Big-Endian byte order, while
            // .NET uses Little-Endian. These wrappers convert between the
            // two.  See BigEndianReader and BigEndianWriter below for more details.
            reader = new BigEndianBinaryReader(stream);
            writer = new BigEndianBinaryWriter(stream);
            zrleReader = new ZRLECompressedReader(stream);
        }