25 std::optional<std::string>
nextLine();
Enumeration for client types in the server.
One client socket plus its read/write buffers.
void flushWrite()
Try to send the buffered write data over the socket.
void setType(ClientType type)
void queueWrite(const std::string &msg)
Append msg to the write buffer (not sent until flushWrite()).
bool hasPendingWrite() const
True if there is still unsent data in the write buffer.
std::optional< std::string > nextLine()
Pop one complete ' '-terminated line, or nullopt if none buffered yet.
ClientType type() const
Client kind: PENDING until the handshake promotes it to AI or GUI.
void appendRead(std::string_view data)
Append freshly-read bytes to the read buffer.
Connection & operator=(const Connection &)=delete
int playerId() const
Player this connection drives (-1 for GUI / not yet assigned).
Connection(const Connection &)=delete