Learn how to evaluate and integrate the VNC SDK

We're here if you need help.

Server

public final class Server

A VNC-compatible Server enabling a computer to be remotely controlled.

Constructor Summary

  • Server(String agentPath, boolean isService)

    Creates a Server, optionally specifying whether to run as a service.

  • Server(String agentPath)

    Creates a Server.

  • Server(android.content.Context context, android.media.projection.MediaProjection mediaProjection)

    Creates a Server for Android.

Method Summary

Modifier and Type Method and Description
void

destroy()

Destroys the Server.

void

disconnect(Connection connection, String message, java.lang.Iterable<DisconnectFlags> flags)

Disconnects a particular Viewer, optionally specifying a message.

void

disconnectAll(String message, java.lang.Iterable<DisconnectFlags> flags)

Disconnects all Viewers, optionally specifying a message.

void

enableAudio(boolean enable)

Enables transmission of audio from the Server to the Viewer.

AnnotationManager

getAnnotationManager()

Obtains the Server’s AnnotationManager for handling annotation operations.

int

getConnectionCount()

Returns the total number of Viewers currently connected to the Server.

ConnectionHandler

getConnectionHandler()

Obtains the Server’s ConnectionHandler for performing connection operations.

DisplayManager

getDisplayManager()

Obtains the Server’s DisplayManager, for managing the list of displays made available by the Server and for setting the Server’s capture method.

EncryptionLevel

getEncryptionLevel(Connection connection)

Returns the encryption level being used with an incoming connection, or the Server’s current encryption level if the connection is null.

int

getIdleTimeout()

Gets the current number of seconds to wait before disconnecting idle Viewers.

MessagingManager

getMessagingManager()

Obtains the Server’s MessagingManager for handling messaging.

String

getPeerAddress(Connection connection)

Returns the address of a particular connected Viewer.

java.util.EnumSet

getPermissions(Connection connection)

Gets the set of current permissions for a Viewer.

boolean

isAgentReady()

Determines if the vncagent process is ready and available to capture the display and inject input events.

void

setAgentCallback(Server.AgentCallback callback)

Sets agent-related callbacks for the Server.

void

setBlacklist(int threshold, int timeout)

Specifies a blacklist threshold and timeout for the Server.

void

setCaptureMethod(CaptureMethod captureMethod)

Specifies the screen capture method used by the Server.

void

setConnectionCallback(Server.ConnectionCallback callback)

Sets connection-related callbacks for the Server.

void

setEncryptionLevel(EncryptionLevel level)

Sets the desired encryption level of the session from the range of options enumerated by ENCRYPTION_LEVEL.

void

setFriendlyName(String name)

Specifies a friendly name for the Server, to send to connected Viewers.

void

setIdleTimeout(int idleTimeout)

Sets the number of seconds to wait before disconnecting idle Viewers.

void

setInputEventsCallback(Server.InputEventsCallback callback)

Sets input control related callbacks for the Server.

void

setPermissions(Connection connection, java.lang.Iterable<Permissions> perms)

Changes permissions for a Viewer mid-session.

void

setSecurityCallback(Server.SecurityCallback callback)

Sets security-related callbacks for the Server.

void

setVncAuthPassword(String password)

Set a password for use with third-party VNC Viewers, using VncAuth authentication.

Constructors

public Server(String agentPath, boolean isService) throws Library.VncException

Creates a Server, optionally specifying whether to run as a service.

This constructor should not be used on Android.

Parameters:
  • agentPath – The full path to the vncagent executable, or null to specify that vncagent is in the same directory as the app binary at run-time. If you provide a directory, the executable must be called vncagent (vncagent.exe on Windows); if you have renamed vncagent then the filename must be provided.
  • isService – Whether to run as a service.
public Server(String agentPath) throws Library.VncException

Creates a Server.

This constructor should not be used on Android.

Parameters:
  • agentPath – The full path to the vncagent executable (see Server(String, boolean) for details).
public Server(android.content.Context context, android.media.projection.MediaProjection mediaProjection) throws Library.VncException

Creates a Server for Android.

Parameters:
  • context – The application context.
  • mediaProjection – An android.media.projection.MediaProjection object.

The android.media.projection.MediaProjection object must be obtained from android.media.projection.MediaProjectionManager - see the Android documentation or sample code for more details on how to do this.

Methods

public void destroy()

Destroys the Server.

For more information, see vnc_Server_destroy().

public void disconnect(Connection connection, String message, java.lang.Iterable<DisconnectFlags> flags)

Disconnects a particular Viewer, optionally specifying a message.

For more information, see vnc_Server_disconnect().

public void disconnectAll(String message, java.lang.Iterable<DisconnectFlags> flags)

Disconnects all Viewers, optionally specifying a message.

For more information, see vnc_Server_disconnectAll().

public void enableAudio(boolean enable) throws Library.VncException

Enables transmission of audio from the Server to the Viewer.

For more information, see vnc_Server_enableAudio().

public AnnotationManager getAnnotationManager() throws Library.VncException

Obtains the Server’s AnnotationManager for handling annotation operations.

public int getConnectionCount()

Returns the total number of Viewers currently connected to the Server.

For more information, see vnc_Server_getConnectionCount().

public ConnectionHandler getConnectionHandler() throws Library.VncException

Obtains the Server’s ConnectionHandler for performing connection operations.

public DisplayManager getDisplayManager() throws Library.VncException

Obtains the Server’s DisplayManager, for managing the list of displays made available by the Server and for setting the Server’s capture method.

public EncryptionLevel getEncryptionLevel(Connection connection)

Returns the encryption level being used with an incoming connection, or the Server’s current encryption level if the connection is null.

For more information, see vnc_Server_getEncryptionLevel().

public int getIdleTimeout()

Gets the current number of seconds to wait before disconnecting idle Viewers.

For more information, see vnc_Server_getIdleTimeout().

public MessagingManager getMessagingManager() throws Library.VncException

Obtains the Server’s MessagingManager for handling messaging.

public String getPeerAddress(Connection connection) throws Library.VncException

Returns the address of a particular connected Viewer.

For more information, see vnc_Server_getPeerAddress().

public java.util.EnumSet<Permissions> getPermissions(Connection connection) throws Library.VncException

Gets the set of current permissions for a Viewer.

For more information, see vnc_Server_getPermissions().

public boolean isAgentReady()

Determines if the vncagent process is ready and available to capture the display and inject input events.

For more information, see vnc_Server_isAgentReady().

public void setAgentCallback(Server.AgentCallback callback) throws Library.VncException

Sets agent-related callbacks for the Server.

For more information, see vnc_Server_setAgentCallback().

public void setBlacklist(int threshold, int timeout) throws Library.VncException

Specifies a blacklist threshold and timeout for the Server.

For more information, see vnc_Server_setBlacklist().

public void setCaptureMethod(CaptureMethod captureMethod) throws Library.VncException

Specifies the screen capture method used by the Server.

For more information, see vnc_Server_setCaptureMethod().

public void setConnectionCallback(Server.ConnectionCallback callback) throws Library.VncException

Sets connection-related callbacks for the Server.

For more information, see vnc_Server_setConnectionCallback().

public void setEncryptionLevel(EncryptionLevel level) throws Library.VncException

Sets the desired encryption level of the session from the range of options enumerated by ENCRYPTION_LEVEL.

For more information, see vnc_Server_setEncryptionLevel().

public void setFriendlyName(String name)

Specifies a friendly name for the Server, to send to connected Viewers.

For more information, see vnc_Server_setFriendlyName().

public void setIdleTimeout(int idleTimeout) throws Library.VncException

Sets the number of seconds to wait before disconnecting idle Viewers.

For more information, see vnc_Server_setIdleTimeout().

public void setInputEventsCallback(Server.InputEventsCallback callback) throws Library.VncException

Sets input control related callbacks for the Server.

For more information, see vnc_Server_setInputEventsCallback().

public void setPermissions(Connection connection, java.lang.Iterable<Permissions> perms) throws Library.VncException

Changes permissions for a Viewer mid-session.

For more information, see vnc_Server_setPermissions().

public void setSecurityCallback(Server.SecurityCallback callback) throws Library.VncException

Sets security-related callbacks for the Server.

For more information, see vnc_Server_setSecurityCallback().

public void setVncAuthPassword(String password) throws Library.VncException

Set a password for use with third-party VNC Viewers, using VncAuth authentication.

For more information, see vnc_Server_setVncAuthPassword().

×