Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Edgaru089

Pages: [1]
1
Feature requests / Re: Asynchronously transfer files via ftp
« on: August 08, 2017, 03:11:54 pm »
I think this is thread safe, for only one thread would write data at once, and there's only one primitive data object (thus one memory block). The other threads are only reading the data, so there should be no problem with thread safety.

2
Feature requests / Re: Asynchronously transfer files via ftp
« on: August 08, 2017, 10:39:36 am »
Quote
Since SFML 2 is still stuck at C++03, use sf::Thread please.
Ouch. I think that's one of the major reasons why nobody ever started working on it.

I just made&pushed a implementation using std::thread:
sf::Ftp::TransferState state;
server.downloadAsynced(filename, directory,sf::Ftp::Binary,state);

while (!state.isTransferCompleted())
    std::printf("\r%.2f KB / Total %.2f KB", (float)state.getTransferedSize() / 1024.0f, (float)fileSize / 1024.0f);

std::printf("\nCompleted", (float)fileSize / 1024.0f, (float)fileSize / 1024.0f);
 

3
Feature requests / Re: Asynchronously transfer files via ftp
« on: August 08, 2017, 09:23:00 am »
I forked the SFML git repository a few months ago (https://github.com/Edgaru089/SFML), and I'm currently working on it. Should I start a issue first? Or just simply start a pull request when I'm ready?
BTW, should I use std::thread or sf::Thread to perform a transfer?

4
Feature requests / Asynchronously transfer files via ftp
« on: August 08, 2017, 03:17:49 am »
Is it possible for sf::Ftp to transfer(download/upload) files in a separate thread?
Something like this:
sf::Ftp ftp;
ftp.connect("ftp.server.com");
ftp.login("username","password");

ftp.startDownload("remotefile.txt", "local/path");

while(ftp.isTransfering())
    std::cout<<"\rStatus: "<<ftp.getTransferPercentage()<<"%";
std::cout<<std::endl<<"Done."<<std::endl;
 

Pages: [1]
anything