C# Класс VncSharpWpf.VncClient

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

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

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.
Результат bool

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

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.
Результат bool

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

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).
Результат bool

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

public Connect ( string host, int display, int port ) : bool
host string
display int
port int
Результат bool

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

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.
Результат bool

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

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
Результат void

EncryptChallenge() защищенный Метод

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.
Результат byte[]

GetSupportedSecurityType() защищенный Метод

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.
Результат byte

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

Finish setting-up protocol with VNC Host. Should be called after Connect and Authenticate (if password required).
public Initialize ( ) : void
Результат void

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

Wait for a connection from VNC Server.
public Listen ( string host, int port, bool viewOnly ) : void
host string
port int
viewOnly bool
Результат void

OnConnectionLost() защищенный Метод

protected OnConnectionLost ( ) : void
Результат void

OnServerCutText() защищенный Метод

protected OnServerCutText ( ) : void
Результат void

PerformVncAuthentication() защищенный Метод

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.
Результат void

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

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.
Результат void

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

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).
Результат void

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

Begin getting updates from the VNC Server. This will continue until StopUpdates() is called. NOTE: this must be called after Connect().
public StartUpdates ( ) : void
Результат void

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

public StopListen ( ) : void
Результат void

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

public VncClient ( ) : System
Результат System

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

public WriteClientCutText ( string text ) : void
text string
Результат void

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

public WriteKeyboardEvent ( uint keysym, bool pressed ) : void
keysym uint
pressed bool
Результат void

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

public WritePointerEvent ( byte buttonMask, Point point ) : void
buttonMask byte
point Point
Результат void