1
Window / Framerate drops from 1.6 to 2.0
« on: February 14, 2012, 06:55:56 am »
Do you compile your code with DEBUG mode or RELEASE mode?
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.
read from server
parse data if any
do logic
send to server
check new connection
check and handle clients, kick out dropped etc not valid
Read data
do logic
send data
1
2
3
4
5
6
7
8
9
0
a
b
c
d
e
f
bool cUpdater::bDownloadChangedFiles(const std::string _sFilename, sf::RenderWindow &_APP) {
sf::Http Http;
Http.SetHost("192.168.1.34");
std::string sURI;
std::string sDestination;
sURI = "/" + _sFilename ; // filename which need to update
sf::Http::Request Request;
Request.SetMethod(sf::Http::Request::Get);
Request.SetURI(sURI);
sf::Http::Response Page = Http.SendRequest(Request);
int iFileSize = 0;
iFileSize = Page.GetBody().size() ;
// IS this right way to handle GetBody for 'binary' files
std::string sFileContainer = Page.GetBody();
// just for test
const char * cs = sFileContainer.c_str ();
// quick and dirty save destination
sDestination = "O:\\xth\\data\\"+_sFilename ;
// Open file to write
std::ofstream toFile(sDestination, std::ios::out, std::ios::binary);
// Using put() to write to file
for (int i = 0; i<iFileSize; i++) {
toFile.put(cs[i]);
}
// Tested also write, but same problem
// toFile.write((char*)&sFileContainer, iFileSize);
toFile.close();
return true;
}