NetworkTables Networking

The advantage of the robot program being the server is that it’s at a known network name (and typically at a known address) that is based on the team number. This is why it’s possible in both the NetworkTables client API and in most dashboards to simply provide the team number, rather than a server address. As the robot program is the server, note this means the NetworkTables server is running on the local computer when running in simulation.

Starting a NetworkTables Server

NetworkTableInstance inst = NetworkTableInstance.getDefault();

Starting a NetworkTables Client

NetworkTableInstance inst = NetworkTableInstance.getDefault();

// start a NT4 client
inst.startClient4("example client");

// connect to a roboRIO with team number TEAM

// starting a DS client will try to get the roboRIO address from the DS application

// connect to a specific host/port
inst.setServer("host", NetworkTableInstance.kDefaultPort4)