Learn how to evaluate and integrate the VNC SDK
Server¶
-
public final class
Server¶ A VNC-compatible Server enabling a computer to be remotely controlled.
Nested Classes¶
- interface
Server.AgentCallback - interface
Server.CaptureCallback - enum
Server.CaptureMethod - interface
Server.ConnectionCallback - enum
Server.DisconnectFlags - enum
Server.Encoding - enum
Server.EncryptionLevel - interface
Server.InputEventsCallback - enum
Server.Permissions - interface
Server.SecurityCallback
Constructor Summary¶
Server(StringagentPath,booleanisService)Creates a Server, optionally specifying whether to run as a service.
-
Creates a Server.
Server(android.content.Contextcontext,android.hardware.display.VirtualDisplayvirtualDisplay)Creates a Server for Android.
Server(android.content.Contextcontext,android.media.projection.MediaProjectionmediaProjection)Creates a Server for Android.
Method Summary¶
| Modifier and Type | Method and Description |
|---|---|
void |
Adds a changed region to the SDK to send on to the Viewer. |
void |
Tells the Server that the framebuffer is ready for capture. |
void |
Destroys the Server. |
void |
Disconnects a particular Viewer, optionally specifying a message. |
void |
Disconnects all Viewers, optionally specifying a message. |
void |
Enables transmission of audio from the Server to the Viewer. |
AnnotationManager |
Obtains the Server’s |
int |
Returns the total number of Viewers currently connected to the Server. |
ConnectionHandler |
Obtains the Server’s |
DisplayManager |
Obtains the Server’s |
Encoding |
Gets the currently set encoding, whether automatically determined or set by |
EncryptionLevel |
Returns the encryption level being used with an incoming connection, or the Server’s current encryption level if the connection is |
int |
Gets the current number of seconds to wait before disconnecting idle Viewers. |
int |
Getter to obtain the JPEG quality setting - a trade-off between quality and level of compression when using JPEG or JRLE encoding types. |
MessagingManager |
Obtains the Server’s |
String |
Returns the address of a particular connected Viewer. |
java.util.EnumSet |
Gets the set of current permissions for a Viewer. |
boolean |
Determines if the |
void |
Sets agent-related callbacks for the Server. |
void |
Specifies a blacklist threshold and timeout for the Server. |
void |
Sets capture related callbacks for the Server. |
void |
Sets capture details. |
void |
Specifies the screen capture method used by the Server. |
void |
Sets connection-related callbacks for the Server. |
void |
Enables the use of a specific encoding for the session. |
void |
Sets the desired encryption level of the session from the range of options enumerated by |
void |
Specifies a friendly name for the Server, to send to connected Viewers. |
void |
Sets the number of seconds to wait before disconnecting idle Viewers. |
void |
Sets input control related callbacks for the Server. |
void |
Getter and setter to control the trade-off between quality and level of compression when using JPEG or JRLE encoding types. |
void |
Changes permissions for a Viewer mid-session. |
void |
Sets security-related callbacks for the Server. |
void |
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
vncagentexecutable, or null to specify thatvncagentis in the same directory as the app binary at run-time. If you provide a directory, the executable must be calledvncagent(vncagent.exeon Windows); if you have renamedvncagentthen the filename must be provided. - isService – Whether to run as a service.
- agentPath – The full path to the
-
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
vncagentexecutable (seeServer(String, boolean)for details).
- agentPath – The full path to the
-
public
Server(android.content.Context context, android.hardware.display.VirtualDisplay virtualDisplay) throws Library.VncException¶ Creates a Server for Android.
Parameters: - context – The application context.
- virtualDisplay – An
android.hardware.display.VirtualDisplayobject.
Note that any provided
android.view.Surfacewill be overridden by the SDK.New in version 1.15.1.
-
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.MediaProjectionobject.
The
android.media.projection.MediaProjectionobject must be obtained fromandroid.media.projection.MediaProjectionManager- see the Android documentation or sample code for more details on how to do this. This constructor is not compatible with Android 14+ Media Projection, where security changes mean that the application must retain control over the Media Projection object. For those platforms you should use the alternative constructor and provide a VirtualDisplay object instead of the MediaProjection object.
Methods¶
-
public void
addChangedRegion(int x1, int y1, int x2, int y2)¶ Adds a changed region to the SDK to send on to the Viewer.
For more information, see
vnc_Server_addChangedRegion().
-
public void
captureReady()¶ Tells the Server that the framebuffer is ready for capture.
For more information, see
vnc_Server_captureReady().
-
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
AnnotationManagerfor 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
ConnectionHandlerfor 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 Encoding
getEncoding()¶ Gets the currently set encoding, whether automatically determined or set by
Server.setEncoding().For more information, see
vnc_Server_getEncoding().
-
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 int
getJpegQuality()¶ Getter to obtain the JPEG quality setting - a trade-off between quality and level of compression when using JPEG or JRLE encoding types.
For more information, see
vnc_Server_getJpegQuality().
-
public MessagingManager
getMessagingManager() throws Library.VncException¶ Obtains the Server’s
MessagingManagerfor 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
vncagentprocess 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
setCaptureCallback(Server.CaptureCallback callback) throws Library.VncException¶ Sets capture related callbacks for the Server.
For more information, see
vnc_Server_setCaptureCallback().
-
public void
setCaptureDetails(int width, int height, int stride, ImmutablePixelFormat pf, byte[] fb)¶ Sets capture details.
For more information, see
vnc_Server_setCaptureDetails().
-
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
setEncoding(Encoding encoding) throws Library.VncException¶ Enables the use of a specific encoding for the session.
For more information, see
vnc_Server_setEncoding().
-
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
setJpegQuality(int quality) throws Library.VncException¶ Getter and setter to control the trade-off between quality and level of compression when using JPEG or JRLE encoding types.
For more information, see
vnc_Server_setJpegQuality().
-
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().