WPILibC++  unspecified
Client/Server Functions

Functions

void NT_SetNetworkIdentity (NT_Inst inst, const char *name, size_t name_len)
 Set the network identity of this node. More...
 
unsigned int NT_GetNetworkMode (NT_Inst inst)
 Get the current network mode. More...
 
void NT_StartServer (NT_Inst inst, const char *persist_filename, const char *listen_address, unsigned int port)
 Starts a server using the specified filename, listening address, and port. More...
 
void NT_StopServer (NT_Inst inst)
 Stops the server if it is running. More...
 
void NT_StartClientNone (NT_Inst inst)
 Starts a client. More...
 
void NT_StartClient (NT_Inst inst, const char *server_name, unsigned int port)
 Starts a client using the specified server and port. More...
 
void NT_StartClientMulti (NT_Inst inst, size_t count, const char **server_names, const unsigned int *ports)
 Starts a client using the specified (server, port) combinations. More...
 
void NT_StartClientTeam (NT_Inst inst, unsigned int team, unsigned int port)
 Starts a client using commonly known robot addresses for the specified team. More...
 
void NT_StopClient (NT_Inst inst)
 Stops the client if it is running. More...
 
void NT_SetServer (NT_Inst inst, const char *server_name, unsigned int port)
 Sets server address and port for client (without restarting client). More...
 
void NT_SetServerMulti (NT_Inst inst, size_t count, const char **server_names, const unsigned int *ports)
 Sets server addresses for client (without restarting client). More...
 
void NT_SetServerTeam (NT_Inst inst, unsigned int team, unsigned int port)
 Sets server addresses and port for client (without restarting client). More...
 
void NT_StartDSClient (NT_Inst inst, unsigned int port)
 Starts requesting server address from Driver Station. More...
 
void NT_StopDSClient (NT_Inst inst)
 Stops requesting server address from Driver Station. More...
 
void NT_SetUpdateRate (NT_Inst inst, double interval)
 Set the periodic update rate. More...
 
void NT_Flush (NT_Inst inst)
 Flush Entries. More...
 
struct NT_ConnectionInfoNT_GetConnections (NT_Inst inst, size_t *count)
 Get information on the currently established network connections. More...
 
NT_Bool NT_IsConnected (NT_Inst inst)
 Return whether or not the instance is connected to another node. More...
 
void nt::NetworkTableInstance::SetNetworkIdentity (StringRef name)
 Set the network identity of this node. More...
 
unsigned int nt::NetworkTableInstance::GetNetworkMode () const
 Get the current network mode. More...
 
void nt::NetworkTableInstance::StartServer (StringRef persist_filename="networktables.ini", const char *listen_address="", unsigned int port=kDefaultPort)
 Starts a server using the specified filename, listening address, and port. More...
 
void nt::NetworkTableInstance::StopServer ()
 Stops the server if it is running.
 
void nt::NetworkTableInstance::StartClient ()
 Starts a client. More...
 
void nt::NetworkTableInstance::StartClient (const char *server_name, unsigned int port=kDefaultPort)
 Starts a client using the specified server and port. More...
 
void nt::NetworkTableInstance::StartClient (ArrayRef< std::pair< StringRef, unsigned int >> servers)
 Starts a client using the specified (server, port) combinations. More...
 
void nt::NetworkTableInstance::StartClient (ArrayRef< StringRef > servers, unsigned int port=kDefaultPort)
 Starts a client using the specified servers and port. More...
 
void nt::NetworkTableInstance::StartClientTeam (unsigned int team, unsigned int port=kDefaultPort)
 Starts a client using commonly known robot addresses for the specified team. More...
 
void nt::NetworkTableInstance::StopClient ()
 Stops the client if it is running.
 
void nt::NetworkTableInstance::SetServer (const char *server_name, unsigned int port=kDefaultPort)
 Sets server address and port for client (without restarting client). More...
 
void nt::NetworkTableInstance::SetServer (ArrayRef< std::pair< StringRef, unsigned int >> servers)
 Sets server addresses and ports for client (without restarting client). More...
 
void nt::NetworkTableInstance::SetServer (ArrayRef< StringRef > servers, unsigned int port=kDefaultPort)
 Sets server addresses and port for client (without restarting client). More...
 
void nt::NetworkTableInstance::SetServerTeam (unsigned int team, unsigned int port=kDefaultPort)
 Sets server addresses and port for client (without restarting client). More...
 
void nt::NetworkTableInstance::StartDSClient (unsigned int port=kDefaultPort)
 Starts requesting server address from Driver Station. More...
 
void nt::NetworkTableInstance::StopDSClient ()
 Stops requesting server address from Driver Station.
 
void nt::NetworkTableInstance::SetUpdateRate (double interval)
 Set the periodic update rate. More...
 
void nt::NetworkTableInstance::Flush () const
 Flushes all updated values immediately to the network. More...
 
std::vector< ConnectionInfo > nt::NetworkTableInstance::GetConnections () const
 Get information on the currently established network connections. More...
 
bool nt::NetworkTableInstance::IsConnected () const
 Return whether or not the instance is connected to another node. More...
 
void nt::SetNetworkIdentity (StringRef name)
 Set the network identity of this node. More...
 
void nt::SetNetworkIdentity (NT_Inst inst, StringRef name)
 
unsigned int nt::GetNetworkMode ()
 Get the current network mode. More...
 
unsigned int nt::GetNetworkMode (NT_Inst inst)
 Get the current network mode. More...
 
void nt::StartServer (StringRef persist_filename, const char *listen_address, unsigned int port)
 Starts a server using the specified filename, listening address, and port. More...
 
void nt::StartServer (NT_Inst inst, StringRef persist_filename, const char *listen_address, unsigned int port)
 
void nt::StopServer ()
 Stops the server if it is running.
 
void nt::StopServer (NT_Inst inst)
 Stops the server if it is running. More...
 
void nt::StartClient ()
 Starts a client. More...
 
void nt::StartClient (const char *server_name, unsigned int port)
 Starts a client using the specified server and port. More...
 
void nt::StartClient (ArrayRef< std::pair< StringRef, unsigned int >> servers)
 Starts a client using the specified (server, port) combinations. More...
 
void nt::StartClient (NT_Inst inst)
 Starts a client. More...
 
void nt::StartClient (NT_Inst inst, const char *server_name, unsigned int port)
 
void nt::StartClient (NT_Inst inst, ArrayRef< std::pair< StringRef, unsigned int >> servers)
 
void nt::StartClientTeam (NT_Inst inst, unsigned int team, unsigned int port)
 Starts a client using commonly known robot addresses for the specified team. More...
 
void nt::StopClient ()
 Stops the client if it is running.
 
void nt::StopClient (NT_Inst inst)
 Stops the client if it is running. More...
 
void nt::SetServer (const char *server_name, unsigned int port)
 Sets server address and port for client (without restarting client). More...
 
void nt::SetServer (ArrayRef< std::pair< StringRef, unsigned int >> servers)
 Sets server addresses for client (without restarting client). More...
 
void nt::SetServer (NT_Inst inst, const char *server_name, unsigned int port)
 
void nt::SetServer (NT_Inst inst, ArrayRef< std::pair< StringRef, unsigned int >> servers)
 
void nt::SetServerTeam (NT_Inst inst, unsigned int team, unsigned int port)
 Sets server addresses and port for client (without restarting client). More...
 
void nt::StartDSClient (unsigned int port)
 Starts requesting server address from Driver Station. More...
 
void nt::StartDSClient (NT_Inst inst, unsigned int port)
 
void nt::StopDSClient ()
 Stops requesting server address from Driver Station. More...
 
void nt::StopDSClient (NT_Inst inst)
 Stops requesting server address from Driver Station. More...
 
void nt::StopRpcServer ()
 Stops the RPC server if it is running. More...
 
void nt::SetUpdateRate (double interval)
 Set the periodic update rate. More...
 
void nt::SetUpdateRate (NT_Inst inst, double interval)
 
void nt::Flush ()
 Flush Entries. More...
 
void nt::Flush (NT_Inst inst)
 Flush Entries. More...
 
std::vector< ConnectionInfo > nt::GetConnections ()
 Get information on the currently established network connections. More...
 
std::vector< ConnectionInfo > nt::GetConnections (NT_Inst inst)
 Get information on the currently established network connections. More...
 
bool nt::IsConnected (NT_Inst inst)
 Return whether or not the instance is connected to another node. More...
 

Detailed Description

Function Documentation

void nt::NetworkTableInstance::Flush ( ) const
inline

Flushes all updated values immediately to the network.

Note
This is rate-limited to protect the network from flooding. This is primarily useful for synchronizing network updates with user code.
void nt::Flush ( )

Flush Entries.

Forces an immediate flush of all local entry changes to network. Normally this is done on a regularly scheduled interval (see SetUpdateRate()).

Note: flushes are rate limited to avoid excessive network traffic. If the time between calls is too short, the flush will occur after the minimum time elapses (rather than immediately).

void nt::Flush ( NT_Inst  inst)

Flush Entries.

Forces an immediate flush of all local entry changes to network. Normally this is done on a regularly scheduled interval (see SetUpdateRate()).

Note: flushes are rate limited to avoid excessive network traffic. If the time between calls is too short, the flush will occur after the minimum time elapses (rather than immediately).

Parameters
instinstance handle
std::vector< ConnectionInfo > nt::NetworkTableInstance::GetConnections ( ) const
inline

Get information on the currently established network connections.

If operating as a client, this will return either zero or one values.

Returns
array of connection information
std::vector< ConnectionInfo > nt::GetConnections ( )

Get information on the currently established network connections.

If operating as a client, this will return either zero or one values.

Returns
array of connection information
std::vector< ConnectionInfo > nt::GetConnections ( NT_Inst  inst)

Get information on the currently established network connections.

If operating as a client, this will return either zero or one values.

Returns
array of connection information
Parameters
instinstance handle
unsigned int nt::NetworkTableInstance::GetNetworkMode ( ) const
inline

Get the current network mode.

Returns
Bitmask of NetworkMode.
unsigned int nt::GetNetworkMode ( )

Get the current network mode.

Returns
Bitmask of NT_NetworkMode.
unsigned int nt::GetNetworkMode ( NT_Inst  inst)

Get the current network mode.

Parameters
instinstance handle
Returns
Bitmask of NT_NetworkMode.
bool nt::NetworkTableInstance::IsConnected ( ) const
inline

Return whether or not the instance is connected to another node.

Returns
True if connected.
bool nt::IsConnected ( NT_Inst  inst)

Return whether or not the instance is connected to another node.

Parameters
instinstance handle
Returns
True if connected.
void NT_Flush ( NT_Inst  inst)

Flush Entries.

Forces an immediate flush of all local entry changes to network. Normally this is done on a regularly scheduled interval (see NT_SetUpdateRate()).

Note: flushes are rate limited to avoid excessive network traffic. If the time between calls is too short, the flush will occur after the minimum time elapses (rather than immediately).

Parameters
instinstance handle
struct NT_ConnectionInfo* NT_GetConnections ( NT_Inst  inst,
size_t *  count 
)

Get information on the currently established network connections.

If operating as a client, this will return either zero or one values.

Parameters
instinstance handle
countreturns the number of elements in the array
Returns
array of connection information

It is the caller's responsibility to free the array. The NT_DisposeConnectionInfoArray function is useful for this purpose.

unsigned int NT_GetNetworkMode ( NT_Inst  inst)

Get the current network mode.

Parameters
instinstance handle
Returns
Bitmask of NT_NetworkMode.
NT_Bool NT_IsConnected ( NT_Inst  inst)

Return whether or not the instance is connected to another node.

Parameters
instinstance handle
Returns
True if connected.
void NT_SetNetworkIdentity ( NT_Inst  inst,
const char *  name,
size_t  name_len 
)

Set the network identity of this node.

This is the name used during the initial connection handshake, and is visible through NT_ConnectionInfo on the remote node.

Parameters
instinstance handle
nameidentity to advertise
name_lenlength of name in bytes
void NT_SetServer ( NT_Inst  inst,
const char *  server_name,
unsigned int  port 
)

Sets server address and port for client (without restarting client).

Parameters
instinstance handle
server_nameserver name (UTF-8 string, null terminated)
portport to communicate over
void NT_SetServerMulti ( NT_Inst  inst,
size_t  count,
const char **  server_names,
const unsigned int *  ports 
)

Sets server addresses for client (without restarting client).

The client will attempt to connect to each server in round robin fashion.

Parameters
instinstance handle
countlength of the server_names and ports arrays
server_namesarray of server names (each a UTF-8 string, null terminated)
portsarray of ports to communicate over (one for each server)
void NT_SetServerTeam ( NT_Inst  inst,
unsigned int  team,
unsigned int  port 
)

Sets server addresses and port for client (without restarting client).

Connects using commonly known robot addresses for the specified team.

Parameters
instinstance handle
teamteam number
portport to communicate over
void NT_SetUpdateRate ( NT_Inst  inst,
double  interval 
)

Set the periodic update rate.

Sets how frequently updates are sent to other nodes over the network.

Parameters
instinstance handle
intervalupdate interval in seconds (range 0.01 to 1.0)
void NT_StartClient ( NT_Inst  inst,
const char *  server_name,
unsigned int  port 
)

Starts a client using the specified server and port.

Parameters
instinstance handle
server_nameserver name (UTF-8 string, null terminated)
portport to communicate over
void NT_StartClientMulti ( NT_Inst  inst,
size_t  count,
const char **  server_names,
const unsigned int *  ports 
)

Starts a client using the specified (server, port) combinations.

The client will attempt to connect to each server in round robin fashion.

Parameters
instinstance handle
countlength of the server_names and ports arrays
server_namesarray of server names (each a UTF-8 string, null terminated)
portsarray of ports to communicate over (one for each server)
void NT_StartClientNone ( NT_Inst  inst)

Starts a client.

Use NT_SetServer to set the server name and port.

Parameters
instinstance handle
void NT_StartClientTeam ( NT_Inst  inst,
unsigned int  team,
unsigned int  port 
)

Starts a client using commonly known robot addresses for the specified team.

Parameters
instinstance handle
teamteam number
portport to communicate over
void NT_StartDSClient ( NT_Inst  inst,
unsigned int  port 
)

Starts requesting server address from Driver Station.

This connects to the Driver Station running on localhost to obtain the server IP address.

Parameters
instinstance handle
portserver port to use in combination with IP from DS
void NT_StartServer ( NT_Inst  inst,
const char *  persist_filename,
const char *  listen_address,
unsigned int  port 
)

Starts a server using the specified filename, listening address, and port.

Parameters
instinstance handle
persist_filenamethe name of the persist file to use (UTF-8 string, null terminated)
listen_addressthe address to listen on, or null to listen on any address. (UTF-8 string, null terminated)
portport to communicate over.
void NT_StopClient ( NT_Inst  inst)

Stops the client if it is running.

Parameters
instinstance handle
void NT_StopDSClient ( NT_Inst  inst)

Stops requesting server address from Driver Station.

Parameters
instinstance handle
void NT_StopServer ( NT_Inst  inst)

Stops the server if it is running.

Parameters
instinstance handle
void nt::NetworkTableInstance::SetNetworkIdentity ( StringRef  name)
inline

Set the network identity of this node.

This is the name used during the initial connection handshake, and is visible through ConnectionInfo on the remote node.

Parameters
nameidentity to advertise
void nt::SetNetworkIdentity ( StringRef  name)

Set the network identity of this node.

This is the name used during the initial connection handshake, and is visible through ConnectionInfo on the remote node.

Parameters
nameidentity to advertise
void nt::SetNetworkIdentity ( NT_Inst  inst,
StringRef  name 
)

Parameters
instinstance handle
void nt::NetworkTableInstance::SetServer ( const char *  server_name,
unsigned int  port = kDefaultPort 
)
inline

Sets server address and port for client (without restarting client).

Parameters
server_nameserver name (UTF-8 string, null terminated)
portport to communicate over
void nt::NetworkTableInstance::SetServer ( ArrayRef< std::pair< StringRef, unsigned int >>  servers)
inline

Sets server addresses and ports for client (without restarting client).

The client will attempt to connect to each server in round robin fashion.

Parameters
serversarray of server name and port pairs
void NetworkTableInstance::SetServer ( ArrayRef< StringRef servers,
unsigned int  port = kDefaultPort 
)

Sets server addresses and port for client (without restarting client).

The client will attempt to connect to each server in round robin fashion.

Parameters
serversarray of server names
portport to communicate over
void nt::SetServer ( const char *  server_name,
unsigned int  port 
)

Sets server address and port for client (without restarting client).

Parameters
server_nameserver name (UTF-8 string, null terminated)
portport to communicate over
void nt::SetServer ( NT_Inst  inst,
const char *  server_name,
unsigned int  port 
)

Parameters
instinstance handle
void nt::SetServer ( ArrayRef< std::pair< StringRef, unsigned int >>  servers)

Sets server addresses for client (without restarting client).

The client will attempt to connect to each server in round robin fashion.

Parameters
serversarray of server name and port pairs
void nt::SetServer ( NT_Inst  inst,
ArrayRef< std::pair< StringRef, unsigned int >>  servers 
)

Parameters
instinstance handle
void nt::NetworkTableInstance::SetServerTeam ( unsigned int  team,
unsigned int  port = kDefaultPort 
)
inline

Sets server addresses and port for client (without restarting client).

Connects using commonly known robot addresses for the specified team.

Parameters
teamteam number
portport to communicate over
void nt::SetServerTeam ( NT_Inst  inst,
unsigned int  team,
unsigned int  port 
)

Sets server addresses and port for client (without restarting client).

Connects using commonly known robot addresses for the specified team.

Parameters
instinstance handle
teamteam number
portport to communicate over
void nt::NetworkTableInstance::SetUpdateRate ( double  interval)
inline

Set the periodic update rate.

Sets how frequently updates are sent to other nodes over the network.

Parameters
intervalupdate interval in seconds (range 0.01 to 1.0)
void nt::SetUpdateRate ( double  interval)

Set the periodic update rate.

Sets how frequently updates are sent to other nodes over the network.

Parameters
intervalupdate interval in seconds (range 0.01 to 1.0)
void nt::SetUpdateRate ( NT_Inst  inst,
double  interval 
)

Parameters
instinstance handle
void nt::NetworkTableInstance::StartClient ( )
inline

Starts a client.

Use SetServer to set the server name and port.

void nt::NetworkTableInstance::StartClient ( const char *  server_name,
unsigned int  port = kDefaultPort 
)
inline

Starts a client using the specified server and port.

Parameters
server_nameserver name (UTF-8 string, null terminated)
portport to communicate over
void nt::NetworkTableInstance::StartClient ( ArrayRef< std::pair< StringRef, unsigned int >>  servers)
inline

Starts a client using the specified (server, port) combinations.

The client will attempt to connect to each server in round robin fashion.

Parameters
serversarray of server name and port pairs
void NetworkTableInstance::StartClient ( ArrayRef< StringRef servers,
unsigned int  port = kDefaultPort 
)

Starts a client using the specified servers and port.

The client will attempt to connect to each server in round robin fashion.

Parameters
serversarray of server names
portport to communicate over
void nt::StartClient ( )

Starts a client.

Use SetServer to set the server name and port.

void nt::StartClient ( NT_Inst  inst)

Starts a client.

Use SetServer to set the server name and port.

Parameters
instinstance handle
void nt::StartClient ( const char *  server_name,
unsigned int  port 
)

Starts a client using the specified server and port.

Parameters
server_nameserver name (UTF-8 string, null terminated)
portport to communicate over
void nt::StartClient ( NT_Inst  inst,
const char *  server_name,
unsigned int  port 
)

Parameters
instinstance handle
void nt::StartClient ( ArrayRef< std::pair< StringRef, unsigned int >>  servers)

Starts a client using the specified (server, port) combinations.

The client will attempt to connect to each server in round robin fashion.

Parameters
serversarray of server name and port pairs
void nt::StartClient ( NT_Inst  inst,
ArrayRef< std::pair< StringRef, unsigned int >>  servers 
)

Parameters
instinstance handle
void nt::NetworkTableInstance::StartClientTeam ( unsigned int  team,
unsigned int  port = kDefaultPort 
)
inline

Starts a client using commonly known robot addresses for the specified team.

Parameters
teamteam number
portport to communicate over
void nt::StartClientTeam ( NT_Inst  inst,
unsigned int  team,
unsigned int  port 
)

Starts a client using commonly known robot addresses for the specified team.

Parameters
instinstance handle
teamteam number
portport to communicate over
void nt::NetworkTableInstance::StartDSClient ( unsigned int  port = kDefaultPort)
inline

Starts requesting server address from Driver Station.

This connects to the Driver Station running on localhost to obtain the server IP address.

Parameters
portserver port to use in combination with IP from DS
void nt::StartDSClient ( unsigned int  port)

Starts requesting server address from Driver Station.

This connects to the Driver Station running on localhost to obtain the server IP address.

Parameters
portserver port to use in combination with IP from DS
void nt::StartDSClient ( NT_Inst  inst,
unsigned int  port 
)

Parameters
instinstance handle
void nt::NetworkTableInstance::StartServer ( StringRef  persist_filename = "networktables.ini",
const char *  listen_address = "",
unsigned int  port = kDefaultPort 
)
inline

Starts a server using the specified filename, listening address, and port.

Parameters
persist_filenamethe name of the persist file to use (UTF-8 string, null terminated)
listen_addressthe address to listen on, or null to listen on any address (UTF-8 string, null terminated)
portport to communicate over
void nt::StartServer ( StringRef  persist_filename,
const char *  listen_address,
unsigned int  port 
)

Starts a server using the specified filename, listening address, and port.

Parameters
persist_filenamethe name of the persist file to use (UTF-8 string, null terminated)
listen_addressthe address to listen on, or null to listen on any address. (UTF-8 string, null terminated)
portport to communicate over.
void nt::StartServer ( NT_Inst  inst,
StringRef  persist_filename,
const char *  listen_address,
unsigned int  port 
)

Parameters
instinstance handle
void nt::StopClient ( NT_Inst  inst)

Stops the client if it is running.

Parameters
instinstance handle
void nt::StopDSClient ( )

Stops requesting server address from Driver Station.

void nt::StopDSClient ( NT_Inst  inst)

Stops requesting server address from Driver Station.

Parameters
instinstance handle
void nt::StopRpcServer ( )

Stops the RPC server if it is running.

void nt::StopServer ( NT_Inst  inst)

Stops the server if it is running.

Parameters
instinstance handle