Test Server#
The TestServer is a kRPC server that runs without the game. The conformance tests run against it, and you can test your own client against it while you write it.
Running the Server#
The TestServer ships in the krpctools Python package. Install it, then start the server on port 50000:
pip install krpctools
krpc-testserver --tcpip-port=50000
The server runs on Linux and Windows, and needs the
.NET 10 runtime. It prints
Server started successfully once it is listening. Without --tcpip-port it listens on a
free port, and prints it as tcpip_port = <port>. Press Ctrl+C to stop it.
Protocols#
--type picks the communication protocol: protobuf for
TCP/IP (the default), localsocket, websockets, serialio or http. Here the server
takes clients over websockets and TCP/IP at the same time:
krpc-testserver --type=websockets,protobuf --websockets-port=50001 \
--tcpip-port=50000
--localsocket-path names the socket of a local socket server, and --serialio-port the
port of a serial IO server. --http-port sets the port of an HTTP server, which prints it as
http_port = <port>, and --http-allowed-origins the origins whose web pages may call it.
--websockets-allowed-origins sets the origins a websockets server accepts, localhost by
default. krpc-testserver --help lists every option, including the bind address, the serial
port settings and the log level.
Services#
The server has the services below. The KRPC.GetServices procedure returns their definitions,
with documentation.
Service |
Purpose |
|---|---|
|
The main kRPC service, which every server has. |
|
Mathematics and printing for server side functions. |
|
Procedures, classes, enumerations and exceptions of every kind, for testing how a client encodes and decodes values and calls procedures. |
|
Server state that the conformance tests control. |
|
A deprecated service, for testing how a client signals the use of its members. |
|
Procedures for measuring the cost of a call and of the server’s update loop. |