WPILibC++ 2023.4.3
wpi::PortForwarder Class Reference

Forward ports to another host. More...

#include <wpinet/PortForwarder.h>

Public Member Functions

 PortForwarder (const PortForwarder &)=delete
 
PortForwarderoperator= (const PortForwarder &)=delete
 
void Add (unsigned int port, std::string_view remoteHost, unsigned int remotePort)
 Forward a local TCP port to a remote host and port. More...
 
void Remove (unsigned int port)
 Stop TCP forwarding on a port. More...
 

Static Public Member Functions

static PortForwarderGetInstance ()
 Get an instance of the PortForwarder class. More...
 

Detailed Description

Forward ports to another host.

This is primarily useful for accessing Ethernet-connected devices from a computer tethered to the RoboRIO USB port.

Constructor & Destructor Documentation

◆ PortForwarder()

wpi::PortForwarder::PortForwarder ( const PortForwarder )
delete

Member Function Documentation

◆ Add()

void wpi::PortForwarder::Add ( unsigned int  port,
std::string_view  remoteHost,
unsigned int  remotePort 
)

Forward a local TCP port to a remote host and port.

Note that local ports less than 1024 won't work as a normal user.

Parameters
portlocal port number
remoteHostremote IP address / DNS name
remotePortremote port number

◆ GetInstance()

static PortForwarder & wpi::PortForwarder::GetInstance ( )
static

Get an instance of the PortForwarder class.

This is a singleton to guarantee that there is only a single instance regardless of how many times GetInstance is called.

◆ operator=()

PortForwarder & wpi::PortForwarder::operator= ( const PortForwarder )
delete

◆ Remove()

void wpi::PortForwarder::Remove ( unsigned int  port)

Stop TCP forwarding on a port.

Parameters
portlocal port number

The documentation for this class was generated from the following file: