BNETDocs
Telnet Protocol Message Formatting

The following information is only valid when using protocol 0x03 (Telnet) on a Classic Battle.net server and only after a successful login handshake. See also Telnet Protocol and Protocol Headers.

NOTICE: Telnet is a legacy protocol that is not used on Battle.net anymore as of 2005. All of the below information should be taken with a grain of salt.

Message Format

When receiving data from Battle.net's flavor of Telnet, a message will come in the following format:

####<SPACE>MSGNAME<SPACE><DATA><EOL>

Where

  • #### is the message id number,
  • MSGNAME is the name of the message,
  • DATA is the contents of the message,
  • SPACE is a space character (ASCII Code 32),
  • and EOL is an End-Of-Line character (ASCII Code 13 and/or 10).

The following PHP code reads a message and breaks it down into its components:

$message = "1018 INFO \"Something spectacular.\"" . PHP_EOL;
$msgid   = substr($message, 0, 4);
$msgname = substr($message, 5, strpos($message, " ", 5) - 5);
$msgdata = substr($message, 6 + strlen($msgname), 0 - strlen(PHP_EOL));

echo "msgid   = '$msgid'" . PHP_EOL
   . "msgname = '$msgname'" . PHP_EOL
   . "msgdata = '$msgdata'" . PHP_EOL;

// msgid   = '1018'
// msgname = 'INFO'
// msgdata = '"Something spectacular."'

Message ID Constants

Interestingly, observations suggest that the ID is serialized in a unique way:

  • 1xxx are EID messages, which can be interpreted as SID_CHATEVENT.
  • 2xxx are SID messages, which can be interpreted as standard Battle.net messages.

The hypothesis is supported by the following example:

2010 NAME JoeUser
1007 CHANNEL "The Void"
1018 INFO "This channel does not have chat privileges."
2000 NULL

There are matching messages for these on the binary (non-Telnet) protocol:

Note how hexadecimal 0x12 is 18 decimal, just like in our message received over Telnet. The messages match up quite nicely.

Overloading Official Battle.net Telnet

For those interested in building their own private Battle.net, such as like what the PvPGN team has accomplished, it's worthwhile to "break" from Blizzard's implementation and send more SID messages to the client than official Battle.net does.

One could easily translate a SID_MESSAGEBOX message into the following, a message that is not sent by official Battle.net to Telnet clients:

2025 DIALOG "An error occurred which caused this dialog to appear."

The above strips off the Caption and Style flags from the SID-style message and leaves only the Text field.

| Edited: Caaaaarrrrlll
Comments
Sixen

Pretty cool findings there... There's lot to test with Telnet now on the W3DM server then, haha.

Caaaaarrrrlll

Yeah I found it out a while back ago when I was making my RBNETD software and was implementing the ol' Telnet protocol but couldn't find a way for SID_MESSAGEBOX through Telnet; this led me to find the format Blizzard was using for the packet ID's in Telnet.

Not sure if someone else actually knew about this or not, but I didn't find it anywhere so I felt compelled to document it.