Learn how to evaluate and integrate the VNC SDK

We're here if you need help.

DirectUdp.h

Listens for or establishes connections using Direct UDP. (more...)

Data structures

Modifier and Type Name and Description
struct

vnc_DirectUdpListener_Callback

Callback for filtering incoming UDP connections.

Defines

Modifier and Type Name and Description
#define

VNC_DIRECT_UDP_DEFAULT_PORT

The default port for VNC direct UDP connections.

Typedefs

Modifier and Type Name and Description
typedef struct vnc_DirectUdpListener

vnc_DirectUdpListener

Listener used to receive incoming UDP connections.

typedef struct vnc_DirectUdpConnector

vnc_DirectUdpConnector

Connector used to make outgoing UDP connections.

Functions

Modifier and Type Name and Description
function vnc_DirectUdpListener *

vnc_DirectUdpListener_create(int port, const char *addressList, vnc_ConnectionHandler *connectionHandler, const vnc_DirectUdpListener_Callback *callback, void *userData)

Begin listening for incoming UDP connections on the given port (IPv4 and IPv6).

function void

vnc_DirectUdpListener_destroy(vnc_DirectUdpListener *listener)

Destroys the UDP listener.

function vnc_DirectUdpConnector *

vnc_DirectUdpConnector_create()

Creates a new UDP Connector which is used to make outgoing connections to UDP listeners.

function void

vnc_DirectUdpConnector_destroy(vnc_DirectUdpConnector *connector)

Destroys the UDP Connector.

function vnc_status_t

vnc_DirectUdpConnector_connect(vnc_DirectUdpConnector *connector, const char *hostOrIpAddress, int port, vnc_ConnectionHandler *connectionHandler)

Begins an outgoing UDP connection to the given hostname or IP address.

Detailed description

Listens for or establishes connections using Direct UDP.

Since
1.8 XXX

Defines

VNC_DIRECT_UDP_DEFAULT_PORT

The default port for VNC direct UDP connections.

Typedefs

typedef struct vnc_DirectUdpListener vnc_DirectUdpListener

Listener used to receive incoming UDP connections.

typedef struct vnc_DirectUdpConnector vnc_DirectUdpConnector

Connector used to make outgoing UDP connections.

Functions

vnc_DirectUdpListener *vnc_DirectUdpListener_create(int port, const char *addressList, vnc_ConnectionHandler *connectionHandler, const vnc_DirectUdpListener_Callback *callback, void *userData)

Begin listening for incoming UDP connections on the given port (IPv4 and IPv6).

To stop listening, destroy the UDP listener.

Return
Returns a new UDP listener on success, or NULL in the case of an error, in which case vnc_getLastError() can be used to get the error code.
Since
1.8 XXX
Parameters
  • port -

    The port number to listen on.

  • addressList -

    A comma-separated list of addresses to listen on. If empty or null then listening starts on all addresses.

  • connectionHandler -

    The object which shall handle incoming connections (if not rejected by the filter function). It is either a server or a viewer. It must be destroyed after the UDP listener.

  • callback -

    An optional callback to filter incoming connections.

  • userData -

    An optional pointer to user data.

Return Value
  • AddressError -

    There was an error listening on the specified address

  • NotEnabled -

    The SDK does not have the Direct UDP add-on enabled

void vnc_DirectUdpListener_destroy(vnc_DirectUdpListener *listener)

Destroys the UDP listener.

Any ongoing connections are not affected, but new connections will not be accepted.

Since
1.8 XXX
Parameters
  • listener -

    The UDP listener to destroy.

vnc_DirectUdpConnector *vnc_DirectUdpConnector_create(void)

Creates a new UDP Connector which is used to make outgoing connections to UDP listeners.

Return
Returns a new UDP Connector on success, or NULL in the case of an error, in which case vnc_getLastError() can be used to get the error code.
Since
1.8 XXX
Return Value
  • NotEnabled -

    The SDK does not have the Direct UDP add-on enabled

void vnc_DirectUdpConnector_destroy(vnc_DirectUdpConnector *connector)

Destroys the UDP Connector.

Since
1.8 XXX
Parameters
  • connector -

    The UDP connector to destroy.

vnc_status_t vnc_DirectUdpConnector_connect(vnc_DirectUdpConnector *connector, const char *hostOrIpAddress, int port, vnc_ConnectionHandler *connectionHandler)

Begins an outgoing UDP connection to the given hostname or IP address.

The connection will be handled by the supplied connectionHandler.

Connection errors are notified using the server or viewer’s callbacks (depending on the type of the connection handler used). This includes errors arising when resolving a specified hostname.

Return
vnc_success is returned on success or vnc_failure in the case of an error, in which case vnc_getLastError() can be used to get the error code.
Since
1.8 XXX
Parameters
  • connector -

    The UDP connector that is to begin the connection.

  • hostOrIpAddress -

    The DNS hostname or IP address to connect to.

  • port -

    The port number to connect to. Note: The default port for VNC connections can be obtained using VNC_DIRECT_UDP_DEFAULT_PORT

  • connectionHandler -

    The object (a Viewer or a Server) to handle the connection.

Return Value
  • InvalidArgument -

    port is invalid, or connectionHandler is a null pointer

struct vnc_DirectUdpListener_Callback
#include <DirectUdp.h>

Callback for filtering incoming UDP connections.

Public Members

vnc_bool_t(* vnc_DirectUdpListener_Callback::filterConnection) (void *userData, vnc_DirectUdpListener *listener, const char *ipAddress, int port)

Notification to provide address-based filtering of incoming connections.

This callback is optional.

Return
vnc_true to allow the connection, or vnc_false to deny, in which case the connection will be closed.
Since
1.8 XXX
Parameters
  • listener -

    The listening object that performed this callback.

  • ipAddress -

    The IP address of the remote end that is attempting to make a connection. The address is presented in a human-readable form such as 122.16.224.1 (IPv4) and 2001:dc8:0:1534:0:867:6:1 (IPv6)

  • port -

    The port on which a connection is being attempted.

×