bool NetConnection::startSendingFile(const char *fileName)
{
   if(!fileName || Con::getBoolVariable("$NetConnection::neverUploadFiles"))
   {
      sendConnectionMessage(SendNextDownloadRequest);
      return false;
   }

   mCurrentDownloadingFile = FileStream::createAndOpen( fileName, Torque::FS::File::Read );
   if(!mCurrentDownloadingFile)
   {
      // the server didn't have the file, so send a 0 byte chunk:
      Con::printf("No such file '%s'.", fileName);
      postNetEvent(new FileChunkEvent(NULL, 0));
      return false;
   }

   Con::printf("Sending file '%s'.", fileName);
   mCurrentFileBufferSize = mCurrentDownloadingFile->getStreamSize();
   mCurrentFileBufferOffset = 0;

   // always have 32 file chunks (64 bytes each) in transit
   sendConnectionMessage(FileDownloadSizeMessage, mCurrentFileBufferSize);
   for(U32 i = 0; i < 32; i++)
      sendFileChunk();
   return true;
}
void HostSideMessageProcess::onMessage(Message* msg) {
    HostData* hd = dynamic_cast<HostData*>(msg);
    if (hd) {
        storage = (HostStorage*) StorageList::createHostStorage(this, hd);
        sendConnectionMessage(true);
    }
    else {
        if (storage) storage->getReceiver()->update(msg);
    }
    delete msg;
}
void HostSideMessageProcess::onStop() {
    sendConnectionMessage(false);
}