C# Class VncSharpWpf.VncClient

Afficher le fichier Open project: nakano531/VncSharpWpf Class Usage Examples

Méthodes publiques

Méthode Description
Authenticate ( string password ) : bool

Use a password to authenticate with a VNC Host. NOTE: This is only necessary if Connect() returns TRUE.

Connect ( string host ) : bool

Connect to a VNC Host and determine which type of Authentication it uses. If the host uses Password Authentication, a call to Authenticate() will be required. Default Display and Port numbers are used.

Connect ( string host, int display ) : bool

Connect to a VNC Host and determine which type of Authentication it uses. If the host uses Password Authentication, a call to Authenticate() will be required. The Port number is calculated based on the Display.

Connect ( string host, int display, int port ) : bool
Connect ( string host, int display, int port, bool viewOnly ) : bool

Connect to a VNC Host and determine which type of Authentication it uses. If the host uses Password Authentication, a call to Authenticate() will be required.

Disconnect ( ) : void

Stops sending requests for updates and disconnects from the remote host. You must call Connect() again if you wish to re-establish a connection.

Initialize ( ) : void

Finish setting-up protocol with VNC Host. Should be called after Connect and Authenticate (if password required).

Listen ( string host, int port, bool viewOnly ) : void

Wait for a connection from VNC Server.

RequestScreenUpdate ( bool refreshFullScreen ) : void

Requests that the remote host send a screen update.

RequestScreenUpdate needs to be called whenever the client screen needs to be updated to reflect the state of the remote desktop. Typically you only need to have a particular region of the screen updated and can still use the rest of the pixels on the client-side (i.e., when moving the mouse pointer, only the area around the pointer changes). Therefore, you should almost always set refreshFullScreen to FALSE. If the client-side image becomes corrupted, call RequestScreenUpdate with refreshFullScreen set to TRUE to get the complete image sent again.

SetInputMode ( bool viewOnly ) : void

Changes the input mode to view-only or interactive.

StartUpdates ( ) : void

Begin getting updates from the VNC Server. This will continue until StopUpdates() is called. NOTE: this must be called after Connect().

StopListen ( ) : void
VncClient ( ) : System
WriteClientCutText ( string text ) : void
WriteKeyboardEvent ( uint keysym, bool pressed ) : void
WritePointerEvent ( byte buttonMask, Point point ) : void

Méthodes protégées

Méthode Description
EncryptChallenge ( string password, byte challenge ) : byte[]

Encrypts a challenge using the specified password. See RFB Protocol Document v. 3.8 section 6.2.2.

GetSupportedSecurityType ( byte types ) : byte

Examines a list of Security Types supported by a VNC Server and chooses one that the Client supports. See 6.1.2 of the RFB Protocol document v. 3.8.

OnConnectionLost ( ) : void
OnServerCutText ( ) : void
PerformVncAuthentication ( string password ) : void

Performs VNC Authentication using VNC DES encryption. See the RFB Protocol doc 6.2.2.

Private Methods

Méthode Description
Beep ( int freq, int duration ) : bool
CheckIfThreadDone ( ) : bool
ConnectCore ( string host, int display, int &port, bool viewOnly, bool connectFromClient ) : bool

Main Function for Connect Process.

ConnectedFromServerEventHandler ( object sender, EventArgs e ) : void

EventHandler for event "ConnectedFromServer"

DoHandShake ( ) : bool
FailedToListenHandler ( object sender, EventArgs e ) : void

EventHandler for event "FailedToListen"

GetRfbUpdates ( ) : void

Worker thread lives here and processes protocol messages infinitely, triggering events or other actions as necessary.

Method Details

Authenticate() public méthode

Use a password to authenticate with a VNC Host. NOTE: This is only necessary if Connect() returns TRUE.
public Authenticate ( string password ) : bool
password string The password to use.
Résultat bool

Connect() public méthode

Connect to a VNC Host and determine which type of Authentication it uses. If the host uses Password Authentication, a call to Authenticate() will be required. Default Display and Port numbers are used.
public Connect ( string host ) : bool
host string The IP Address or Host Name of the VNC Host.
Résultat bool

Connect() public méthode

Connect to a VNC Host and determine which type of Authentication it uses. If the host uses Password Authentication, a call to Authenticate() will be required. The Port number is calculated based on the Display.
public Connect ( string host, int display ) : bool
host string The IP Address or Host Name of the VNC Host.
display int The Display number (used on Unix hosts).
Résultat bool

Connect() public méthode

public Connect ( string host, int display, int port ) : bool
host string
display int
port int
Résultat bool

Connect() public méthode

Connect to a VNC Host and determine which type of Authentication it uses. If the host uses Password Authentication, a call to Authenticate() will be required.
public Connect ( string host, int display, int port, bool viewOnly ) : bool
host string The IP Address or Host Name of the VNC Host.
display int The Display number (used on Unix hosts).
port int The Port number used by the Host, usually 5900.
viewOnly bool True if mouse/keyboard events are to be ignored.
Résultat bool

Disconnect() public méthode

Stops sending requests for updates and disconnects from the remote host. You must call Connect() again if you wish to re-establish a connection.
public Disconnect ( ) : void
Résultat void

EncryptChallenge() protected méthode

Encrypts a challenge using the specified password. See RFB Protocol Document v. 3.8 section 6.2.2.
protected EncryptChallenge ( string password, byte challenge ) : byte[]
password string The user's password.
challenge byte The challenge sent by the server.
Résultat byte[]

GetSupportedSecurityType() protected méthode

Examines a list of Security Types supported by a VNC Server and chooses one that the Client supports. See 6.1.2 of the RFB Protocol document v. 3.8.
protected GetSupportedSecurityType ( byte types ) : byte
types byte An array of bytes representing the Security Types supported by the VNC Server.
Résultat byte

Initialize() public méthode

Finish setting-up protocol with VNC Host. Should be called after Connect and Authenticate (if password required).
public Initialize ( ) : void
Résultat void

Listen() public méthode

Wait for a connection from VNC Server.
public Listen ( string host, int port, bool viewOnly ) : void
host string
port int
viewOnly bool
Résultat void

OnConnectionLost() protected méthode

protected OnConnectionLost ( ) : void
Résultat void

OnServerCutText() protected méthode

protected OnServerCutText ( ) : void
Résultat void

PerformVncAuthentication() protected méthode

Performs VNC Authentication using VNC DES encryption. See the RFB Protocol doc 6.2.2.
protected PerformVncAuthentication ( string password ) : void
password string A string containing the user's password in clear text format.
Résultat void

RequestScreenUpdate() public méthode

Requests that the remote host send a screen update.
RequestScreenUpdate needs to be called whenever the client screen needs to be updated to reflect the state of the remote desktop. Typically you only need to have a particular region of the screen updated and can still use the rest of the pixels on the client-side (i.e., when moving the mouse pointer, only the area around the pointer changes). Therefore, you should almost always set refreshFullScreen to FALSE. If the client-side image becomes corrupted, call RequestScreenUpdate with refreshFullScreen set to TRUE to get the complete image sent again.
public RequestScreenUpdate ( bool refreshFullScreen ) : void
refreshFullScreen bool TRUE if the entire screen should be refreshed, FALSE if only a partial region needs updating.
Résultat void

SetInputMode() public méthode

Changes the input mode to view-only or interactive.
public SetInputMode ( bool viewOnly ) : void
viewOnly bool True if view-only mode is desired (no mouse/keyboard events will be sent).
Résultat void

StartUpdates() public méthode

Begin getting updates from the VNC Server. This will continue until StopUpdates() is called. NOTE: this must be called after Connect().
public StartUpdates ( ) : void
Résultat void

StopListen() public méthode

public StopListen ( ) : void
Résultat void

VncClient() public méthode

public VncClient ( ) : System
Résultat System

WriteClientCutText() public méthode

public WriteClientCutText ( string text ) : void
text string
Résultat void

WriteKeyboardEvent() public méthode

public WriteKeyboardEvent ( uint keysym, bool pressed ) : void
keysym uint
pressed bool
Résultat void

WritePointerEvent() public méthode

public WritePointerEvent ( byte buttonMask, Point point ) : void
buttonMask byte
point Point
Résultat void