Overview
Features
Download
Documentation
Community
Add-Ons & Services

Windows file uploads slower than OS X and Linux

Please post support and help requests here.

Windows file uploads slower than OS X and Linux

Postby bstewart33 » 14 Dec 2012, 23:42

I am new to POC 1.4.5 and have made a test program to upload a file to a php http server [http://posttestserver.com].

The following code I built under MAC OS X(10.8.2) and WIndows Server 2008 R2 Server. When I run the program with a 10MB file, under the MAC I get upload speeds around 10m/s, under windows I get 2m/s. I am using the HTMLForm part method to uoload the file. I also had to turn off chunked transfer encoding due the server not supporting chunked transfer encoding.

Are there other parameters that can be set for windows in order to get speeds equivilant to the MAC?

Here is my code:
URI uri(argv[1]);
std::string path(uri.getPathAndQuery());
if (path.empty()) path = "/";

std::string uploadFilename(argv[2]);

HTTPClientSession &session(
*(new HTTPClientSession(uri.getHost(), uri.getPort())));

for (unsigned int ix( 0 ); ix < ITERATIONS; ix++)
{
HTTPRequest &request(
*(new HTTPRequest(
HTTPRequest::HTTP_POST, path, HTTPMessage::HTTP_1_1)));

HTMLForm &form (
*(new HTMLForm( HTMLForm::ENCODING_MULTIPART ) ) );

FilePartSource *partSource(
new FilePartSource (
uploadFilename, "application/octet-stream"));
//uploadFilename, "Text/Plain"));

std::istream &partStream(partSource->stream());

form.addPart("upload", partSource);

form.prepareSubmit(request);

//Determine content-length from form data
std::stringstream ss;
form.write(ss);
std::string formString(ss.str());

//Reset the form stream to begining of file
partStream.clear();
partStream.seekg(0);

request.setChunkedTransferEncoding(FALSE);
request.setContentLength(
static_cast<unsigned int> (formString.length()));

std::ostream &send = session.sendRequest(request);

form.write (send);

//----- other code to handle response here...

delete &form;
delete &request;
} //For Loop

delete &session;
bstewart33
 
Posts: 2
Joined: 10 Dec 2012, 17:30

Return to Support

Who is online

Users browsing this forum: No registered users and 4 guests