Battle.net's file transfer protocol is fairly simple. The protocol itsself has no headers, and consists of 2 packets - the request, and the response.
The request is sent to Battle.net after connecting and requesting protocol bnFTP (0x02):
(WORD) Request length
(WORD) Protocol Version
(DWORD) Platform ID
(DWORD) Product ID
(DWORD) Banners ID*
(DWORD) Banners File Extension*
(DWORD) Start position in file (for resuming)
(FILETIME) Filetime of local file
(STRING) Filename
Battle.net should respond with the following bnFTP message, which is likely to be split across several TCP packets:
(WORD) Header length - Does not include the length of the file.
(WORD) Unknown (probably padding)
(DWORD) Filesize
(DWORD) Banners ID*
(DWORD) Banners File Extension*
(FILETIME) Remote Filetime
(STRING) Filename
(VOID) File data
After sending this message, Battle.net terminates the connection.
The starred fields (*) are only required when downloading an ad banner. In other cases, they should be set to 0. Version 1 of bnFTP actually has a version of 0x100 (256). It seems likely that it was originally coded with the bytes in the wrong order (in the message, 00 10 instead of 01 00). The second word of the response is probably just padding to preserve DWORD alignment and should be set to 0.
Developers may wish to include FTP support in their clients to download & display product icons (the most common use), or to download & display ad banners, or even to download & decompress the version DLLs for an 'authentic' logon (beware; this is more complicated than it sounds). Even if none of these are useful, many users would enjoy an FTP facility just to satisfy their curiousity!
#9
User Comments:
Posted by Tech-InsaneJoey on 29/01/05 01:27 |
(DWORD Program ID
You're missing a ).
|
#260 |