WPILibC++ 2026.2.2
Loading...
Searching...
No Matches
wpi::WebServer Class Reference

A web server using the HTTP protocol. More...

#include <wpinet/WebServer.h>

Public Member Functions

 WebServer (const WebServer &)=delete
 
WebServer & operator= (const WebServer &)=delete
 
void Start (unsigned int port, std::string_view path)
 Create a web server at the given port.
 
void Stop (unsigned int port)
 Stop web server running at the given port.
 

Static Public Member Functions

static WebServer & GetInstance ()
 Get an instance of the WebServer class.
 

Detailed Description

A web server using the HTTP protocol.

Constructor & Destructor Documentation

◆ WebServer()

wpi::WebServer::WebServer ( const WebServer & )
delete

Member Function Documentation

◆ GetInstance()

static WebServer & wpi::WebServer::GetInstance ( )
static

Get an instance of the WebServer class.

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

◆ operator=()

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

◆ Start()

void wpi::WebServer::Start ( unsigned int port,
std::string_view path )

Create a web server at the given port.

Note that local ports less than 1024 won't work as a normal user. Also, many ports are blocked by the FRC robot radio; check the game manual for what is allowed through the radio firewall.

Parameters
portlocal port number
pathlocal path to document root

◆ Stop()

void wpi::WebServer::Stop ( unsigned int port)

Stop web server running at the given port.

Parameters
portlocal port number

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