This is a line-oriented ASCII protocol, where the client sends commands and the server makes numeric responses. Responses are either in the 1000s (success messages) or 5000s (errors). Server messages in the 2000s are asynchronous and may come at any point. Lines may not exceed 4096 bytes, including \r\n. Each connection is one player. There is only one game at a time. Users who join after the game has started are considered not to be participating. Tiles are specified by letter; _ is a blank, . is an empty square (which is not valid in most contexts.) The server listens on port 7096. Upon connection, the server will issue a banner, one of: 1000 VER Game server ready 5000 Permission to connect denied 5001 Service not available VER, the protocol version, is presently 2. Changes from version 1 to version 2: - added GLIST, GINFO, NEWGAME, JOIN, LEAVE - changed HELP response from 1200 to 1990 - officially obsoleted 2007 - added 2027, 2028 Client commands and replies: NAME username Set (or change) the username/handle to use on the server. 1010 Name set 5010 Illegal name 5011 Name already in use READY Declare that you're ready to start the game. When all connected players are ready, the game starts. 1020 T Ok The T is a tile, which determines who starts first. 5020 Game has already started 5021 You already did that 5022 Not in a game 5023 Use NAME first PLAY x,y,T [x,y,T]... Play the letters T at the board positions x,y (0,0 is the top left corner). There should be no spaces in the x,y,T. There can, as is well known, be as many as 7 letters played at once. 1030 Done. 5030 Your play may not turn corners. 5031 You don't have those letters. 5032 You may not play over existing tiles. 5033 Not your turn. There is no checking whether the word(s) created are legal for the game. That is the responsibility of the players. 5034 Not in a game. 5035 Use NAME first. 5036 Your play may not have gaps in it. APPROVE Accept the previous play. Until all (other) players have accepted a play, the game does not progress. 1040 Ok 5040 No approval required right now. 5041 May not accept your own word. 5042 Not in a game. 5043 Use NAME first. WITHDRAW Withdraw previous move. Must be done before everyone accepts it. Depending on the game settings, may revert to the withdrawing player's turn, or may not. 1050 Ok 5050 No play to withdraw 5051 Not in a game. 5052 Use NAME first. EXCHANGE [tiles] Exchange your rack, as your turn. Does not require approval. If no letters are specified, exchange the whole rack. 1060 Ok 5060 Not your turn. 5061 No exchanges this late in the game. 5062 You don't have those letters. 5063 Not in a game. 5064 Use NAME first. SAY text Distribute "text" to players. One line only. 1070 Told 4 players 5070 Use NAME first. TELL user text Send "text" to the other player "user". 1080 Told user 5080 No such user 5081 Use NAME first. REFRESH Request transmission of current board arrangement, your rack, and the scores. 1090 Ok 5090 Game not started 5091 Not in a game 5092 Use NAME first. QUIT Disconnect. If playing, someone else can take over your position. 1100 Ok The ok line is immediately followed by disconnection. FORFEIT If you can't play and can't exchange, do this. 1110 Ok 5110 Not your turn. 5111 Not in a game. 5112 Use NAME first. OBSERVER Use instead of READY if you don't actually want to play. Not necessary if you join after the game has started. 1120 Ok 5120 You're already playing. 5121 Not in a game. 5122 Use NAME first. WHO Have the server tell you who's connected (including observers). 1130 Ok 5130 Use NAME first. EMOTE text Like SAY but displays as "* user text", for actions 1140 Ok 5140 Use NAME first. BEEP user Asks the user's client to beep or otherwise attract the user's attention. 1150 Ok 5150 No such user 5151 Use NAME first. GLIST Retrieve the list of games from the server. The list may be empty. 1160 gamenum gamenum gamenum... GINFO gamenum Retrieve game information about the specified game. PLAY means the game is being played; FORM means the game is forming. 1170 gamenum PLAY|FORM number-of-players number-of-observers 5170 No such game. NEWGAME Start (and join) a new game. 1180 gamenum Game formed 5180 No space for another game. 5181 Already in a game. 5182 Use NAME first. JOIN gamenum Join an existing game. 1190 Ok 5190 No such game. 5191 Already in a game. 5192 Use NAME first. LEAVE Leave your game (you must not be playing at the time). Note that in protocol version 1, 1200 was the HELP Ok answer. If writing a multi-version client, use caution. 1200 Ok 5200 Not in a game. 5201 You can't leave now. 5202 Use NAME first. HELP Request help. 1990 Ok VERSION Query version numbers. 1980 x y z Where x is the server version, y is the tty client version and z is the Windows client number. These version numbers are the most recent ones available and can be used by clients to determine if an upgrade is available. The general syntax error message code is 5999. Server messages: 2000 user user user ... Issued when the game begins. 2001 T drawn (for play order) You got an extra who-goes-first tile (_not_ tile for playing) because there was a draw. 2002 user Your turn Whose turn it is to play next. 2003 user score x,y,T [x,y,T]... (tiles played) The specified user has made the given play. 2004 user accepts play The specified user accepts the play just made. 2005 user forfeits turn 2006 user withdraws play The specified user withdraws its last play, causing those letters to be removed and the score backed up. A 202 will be sent afterwards to specify whose turn it is; do not make assumptions. 2007 user exchanges rack The specified user chose to waste its turn by exchanging its rack. Not used in the version 2 protocol; see 2023. 2008 user newpoints totalpoints (score) Report the new score for the specified user. 2009 user text The specified user has said "text" to all players. 2010 user text The specified user has said "text" to you alone. 2011 user quit The specified user has quit and can be taken over. 2012 y TTTTTTTTTTTTT Update board row y with the given tiles. 2013 TTTTTTT Report the contents of your rack. Note that it might be empty. 2014 text The server has sent "text" to you and maybe other players. 2015 server disconnecting The server is hanging up. 2016 T drawn (for rack) Tile drawn (for rack) 2017 user wins The game is over, and the specified user has won. 2018 user user user Tie game between the users specified. 2019 olduser newuser name change The user "olduser" changed its name to "newuser". 2020 Game is already in progress. This is sent after connection if it's too late to join the current game except as an observer. (In version 2, it is sent after JOIN.) 2021 Takeover successful. This is sent if an observer has successfully taken over from a disconnected player. 2022 Approval required. This is sent with 2021 if the client needs to issue an approval. 2023 user NUM letters exchanged. The specified user chose to waste its turn by exchanging NUM tiles from its rack. This is sent in addition to 2007 by v5 and higher servers; clients should be prepared to receive both in case they are talking to an older server. In version 2 of the protocol, 2007 is not used. 2024 Game data reset. This means the server has reset the game state for a new game; clients should indicate when they are ready to start again. 2025 user text The specified user has emoted "text" to all players. 2026 hello? Someone has BEEPed you. 2027 NUM New game formed A new game has been formed. 2028 NUM Gamelist info changed New gamelist info available for game NUM. 2999 stuff This message should be ignored by automated clients. Unknown 2000-series messages should be ignored.