Skip to content

Servers

gatchi edited this page May 25, 2017 · 6 revisions

The servers (patch_server, login_server, ship_server) serve client connections that may either be player clients or one of the other servers. Tethealla is written for Windows, and therefore uses the Winsock2 library for networking, and uses select() for managing multiple connections.

Teth has default ports, all of which are connfigurable via ini files (except ship listen port, which is a #define in PSONOVA):

  • Patch server
    • PATCH port: 11000
    • DATA port: 11001
  • Login server
    • LOGIN port: 12000
    • CHARACTER port: 12001
    • ship listen port: 3455
  • Ship server
    • SHIP port: 5278
    • BLOCK ports: 5279+

[add diagram here]

Sockets and select() Overview

A client is an entity that connects to a server. Before a client can connect, a server must bind to a free socket. Think of a socket as a place a cable (network connection) can connect into, like a power cable wanting electricity (client only) or an ethernet cable (client only or server acting as client). The socket isn't the server; its just an interface the server and the network uses. It's bound to a server (inside-facing) and a port (outside-facing). A port on a machine can only be bound to one thing at a time.

Select checks on three lists: ReadFDs, WriteFDs, and ExceptFDs.

ReadFDs

todo

WriteFDs

Data for client connections are stored in a client's send buffer (sndbuf). When clients are ready for data, they test true for FD_ISSET()

Clone this wiki locally