Listen() публичный Метод

Wait for a connection from VNC Server.
public Listen ( string host, int port, bool viewOnly ) : void
host string
port int
viewOnly bool
Результат void
Пример #1
0
        /// <summary>
        /// Wait for a connection from VNC Server.
        /// </summary>
        /// <param name="host">Hostname or IP Address</param>
        /// <param name="port">Listening Port</param>
        /// <param name="viewOnly">Set true if you use viewonly mode</param>
        /// <param name="scaled">Set true if you use scaled mode</param>
        public void Listen(string host, int port = 5500, bool viewOnly = false, bool scaled = false)
        {
            InsureConnection(false);

            if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            vnc = new VncClient();
            vnc.ConnectionLost      += new EventHandler(VncClientConnectionLost);
            vnc.ServerCutText       += new EventHandler(VncServerCutText);
            vnc.ConnectedFromServer += new VncConnectedFromServerHandler(ConnectedFromServerEventHandler);

            desktopPolicy = new VncWpfDesktopPolicy(vnc, this);
            SetScalingMode(scaled);
            SetState(RuntimeState.Listen);
            vnc.Listen(host, port, viewOnly);

            this.waitLabel.Content    = "Wait for a connection at " + Dns.GetHostEntry(host).AddressList[0] + ":" + port;
            this.waitLabel.Visibility = Visibility.Visible;
        }
        /// <summary>
        /// Wait for a connection from VNC Server.
        /// </summary>
        /// <param name="host">Hostname or IP Address</param>
        /// <param name="port">Listening Port</param>
        /// <param name="viewOnly">Set true if you use viewonly mode</param>
        /// <param name="scaled">Set true if you use scaled mode</param>
        public void Listen(string host, int port = 5500, bool viewOnly = false, bool scaled = false)
        {
            InsureConnection(false);

            if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            vnc = new VncClient();
            vnc.ConnectionLost += new EventHandler(VncClientConnectionLost);
            vnc.ServerCutText += new EventHandler(VncServerCutText);
            vnc.ConnectedFromServer += new VncConnectedFromServerHandler(ConnectedFromServerEventHandler);

            desktopPolicy = new VncWpfDesktopPolicy(vnc, this);
            SetScalingMode(scaled);
            SetState(RuntimeState.Listen);
            vnc.Listen(host, port, viewOnly);

            this.waitLabel.Content = "Wait for a connection at " + Dns.GetHostEntry(host).AddressList[0] + ":" + port;
            this.waitLabel.Visibility = Visibility.Visible;
        }