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.
When receiving data from Battle.net's flavor of Telnet, a message will come in the following format:
####is the message id number,
MSGNAMEis the name of the message,
DATAis the contents of the message,
SPACEis a space character (ASCII Code 32),
EOLis 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:
1xxxare EID messages, which can be interpreted as SID_CHATEVENT.
2xxxare 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:
- S>C 0x10 SID_ENTERCHAT
- S>C 0x0F SID_CHATEVENT / 0x07 EID_CHANNEL
- S>C 0x0F SID_CHATEVENT / 0x12 EID_INFO
- S>C 0x00 SID_NULL
Note how hexadecimal
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
Style flags from the SID-style message and leaves only the
Pretty cool findings there... There's lot to test with Telnet now on the W3DM server then, haha.
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.