Asset downloader

This PR provides a mechanism for synchronizing files between the client and the server.
It does allow users to upload content to the server if the file transfer connection is left connected.
The code is implemented using the TCPObject as the base class.  I have taken the liberty to make a couple of TCPObject's functions virtual so I could overload them for binary transfer.
I also modified fileSystemFunctions.cpp and took the body of code out each of the defineconsolefunctions and put them in a function and wrapped all the functions inside a namespace.  I also added a header file which can be included so that programmers are able to access those functions from anywhere in the code base.
Since the FileXfer occurs over TCP,  I am able to use the same port which is used for the game.  This is because T3D runs its network over UDP and this PR is implemented over tcp.

You are able to specify the files you want to include for download by editing the core/Scripts/server/fileXferServer.cs file.

Two ways of adding files to be available for download:

LoadPath (Pattern, Recursive, multiMatch, Verbose) and works just like the FindFiles file searching.
LoadFile (filename) - It will check if the file exists, if it exists it will add it to the download.

Let me know if you find any errors.

Vince Gee
Winterleafentertainment.com

My thought was that if I get back the error WouldBlock then I need to resend the data.

 

From: Daniel Buckmaster [mailto:notifications@github.com] 
Sent: Tuesday, November 25, 2014 7:51 PM
To: GarageGames/Torque3D
Cc: Vincent Gee
Subject: Re: [Torque3D] Asset downloader (#959)

 

In Engine/source/app/net/netFileClient.cpp:

> +void netFileClient::onDisconnect()
> +{
> +   Parent::onDisconnect();
> +   xferFile = NULL ; 
> +   totalDataSize = 0 ;
> +   expectedDataSize = 0 ;
> +   if (!xferFile)
> +      return;
> +   xferFile->close();
> +   xferFile->deleteObject();
> +}
> +
> +void netFileClient::send(const U8 *buffer, U32 len)
> +{
> +   Net::Error err = Net::sendtoSocket(mTag, buffer, S32(len));
> +   while (err == 3) //WouldBlock

Why are you comparing to 3, not WouldBlock?

—
Reply to this email directly or view it on GitHub <https://github.com/GarageGames/Torque3D/pull/959/files#r20909356> .  <https://github.com/notifications/beacon/ACUNZKV5QpX2h4cU3hUBHVdRshaB7mSNks5nRRt-gaJpZM4DAN4b.gif>