Download Online File Access & File I/O

Discussion in 'Modifications' started by Volt Cruelerz, Mar 17, 2012.

  1. Volt Cruelerz

    Volt Cruelerz Legions Developer

    While working on LTS, we've been attempting to create a viable method of transferring data from a third-party server to the client for mods. The result is the mod you'll find below.

    File I/O and Server/Client communication have been two of the biggest hurdles we've attempted to overcome as the documentation on them has in many cases been lackluster. To try to prevent others from having to go through similar difficulties we're releasing this as a standalone demo mod that others may look at and learn from.

    It's tasks are: retrieve a file from Dropbox, print it's contents to the console (aside from the first and last two lines which have been deliberately excluded) and then proceeds to print those things to a file. It's not an overly complicated script or even necessarily practical, but we feel that releasing it should aid others should they decide to make a script that relies on either principle.

    Now, reading this mod is no substitute for reading the documentation, but instead should be viewed as a supplementary tool and demonstration of the use of these things.

  2. Fixious

    Fixious Test Lead

    So, this only works if said files/mods are hosted on Dropbox correct?
  3. Volt Cruelerz

    Volt Cruelerz Legions Developer

    This one retrieves the contents of a .txt file from DB, though it could apply to any server. We just use DB because it's free :p
  4. 3lionz

    3lionz Legions Developer

    In theory you can grab a line from any file on the web, not just a text document.
    (Although it would not be practical to take a line from say... an image.)

    Not sure about ftp, but this does work for http. We use port 80 because it is the standard port for a webpage, however you may need to change it depending on the webpage. Some sites use 8080 as an alternative port. Https will normally use port 443.

    In theory you could take lines from the blog or the forum if you messed around with it. We are using dropbox as a temporary solution, as you can't really "send" anything back to dropbox effectively.

    If anyone could host a server for us in the future, chuck us a message, we may have use for it :p

    If anyone is confused about this little bit of code, just post here.
  5. Shisk

    Shisk Member

    Updated one of my old codes => Pastebin
    Its just an option to use the TCPObject or the HTTPObject to fetch a web page
    Also it adds a queue for the requets