Author Topic: 1.5.0/2.5.0 Server File Transfer sample code - Delphi  (Read 3575 times)

0 Members and 1 Guest are viewing this topic.

Offline chrisgbk

  • Inactive Staff
  • Veteran
  • *****
  • Posts: 1739
1.5.0/2.5.0 Server File Transfer sample code - Delphi
« on: June 09, 2009, 02:39:10 am »
This is a Delphi sample for working with the new file transfer code in 1.5.0/server 2.5.0. Includes a prebuilt executable which can download files from any server.

Creates a 'downloaded' folder where the EXE is run, and all downloaded files are placed in there.

For reference, the allowed file types are:
.png
.jpg
.bmp
.gif
.pms
(from the main server directory or any subfolder thereof)

with exceptions for:
logs/gamestat.txt
logs\gamestat.txt

Linux servers are, of course, case sensitive for filenames.

Protocol:
Code: [Select]
To server:

STARTFILES\r\n
<filename 1>\r\n
<filename 2>\r\n
...
<filename n>\r\n
ENDFILES\r\n

From server:

STARTFILES\r\n
<total size of all files as 4 byte integer>
<filename 1>\r\n
<size of file 1 as 4 byte integer>
<file 1 data>
<filename 2>\r\n
<size of file 2 as 4 byte integer>
<file 2 data>
...
<filename n>\r\n
<size of file n as 4 byte integer>
<file n data>
ENDFILES\r\n
« Last Edit: June 20, 2009, 05:44:16 pm by chrisgbk »

Offline ManSoft|Warlord

  • Major
  • *
  • Posts: 70
  • Soldat.IDE Creator
Re: 1.5.0/2.5.0 Server File Transfer sample code - Delphi
« Reply #1 on: June 12, 2009, 04:25:05 am »
nice! thank you!

Offline Bloo

  • Soldier
  • **
  • Posts: 105
  • Yellow
    • BlueMutiny.com
Re: 1.5.0/2.5.0 Server File Transfer sample code - Delphi
« Reply #2 on: June 13, 2009, 11:02:30 pm »
Er, is there a way to download .txt files from the server using this or any method other than FTP? (for example, banned.txt).

Offline pavliko

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 397
  • >‿‿◕
    • Offical TTW Community
Re: 1.5.0/2.5.0 Server File Transfer sample code - Delphi
« Reply #3 on: June 13, 2009, 11:07:15 pm »
Wow this is exactly what i was waiting for!
THank you!
The safest thing to do is jumping out of a plane!

Offline chrisgbk

  • Inactive Staff
  • Veteran
  • *****
  • Posts: 1739
Re: 1.5.0/2.5.0 Server File Transfer sample code - Delphi
« Reply #4 on: June 14, 2009, 01:56:17 am »
Er, is there a way to download .txt files from the server using this or any method other than FTP? (for example, banned.txt).
No; the server restricts access to these types of files due to their contents.