http://bugs.winehq.org/show_bug.cgi?id=6415
Summary: windows web server app fails to send more than 11680 bytes !? Product: Wine Version: 0.9.22. Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-net AssignedTo: wine-bugs@winehq.org ReportedBy: idc-dragon@gmx.de
I'm testing a windows app I'd very much like to run under Wine being in touch with the author. This is a small web server app (called WRC, for web remote center) based on the Microsoft MFC sample app HTTPSVR. It happily works under Windows, but that'd be the wrong thing for running it 24/7. ;-)
It's not yet working under Wine, fails to serve larger files, but we've pretty much narrowed down the problem by adding logs to the app and using ethereal.
For example, the app tries to write a 25017 bytes .jpg image to the socket, but the socket only allows 11680 bytes at a time, and the TCP stack fragments this in 8 packets of 1460 bytes, presumably because it only has 8 buffers reserved. So far so good.
We see them being sent on the Ethernet and the ACK's are coming in, but after these 8 packets there should be a signal to trigger the OnSend function of the app so it can send the next part of data, but this never happens... The reselection of the socket did not return an error. Given the reselection is ok, and at the Ethernet level messages are consistently sent and ACK's received, the conclusion is that there might be a bug in Wine. So here we are stuck.
The error is very simple, WRC server processes a request and builds a response in a memory buffer called m_buf (member of CRequestSocket).
In case an image is requested it will realloc the buffer and read the complete image into the buffer, setting m_cbOut to the number of bytes in m_buf which are to be sent.
After this the AsyncSelect( FD_WRITE | FD_CLOSE ) member of CRequestSocket is called to initiate the writing of data to the network, this in done by MFC/Windows calling the OnSend member whenever the underlying socket is able to handle data.
In this function we send data and check for an error, a partial send or a complete send. Every time a partial send is completed the AsyncSelect( FD_WRITE | FD_CLOSE ) is repeated so MFC/Windows will get back to us when data is sent on the network, and this seems to fail.
So have a look at the code in "if ( nBytes < m_cbOut )", this is what is being executed when we see that only 11680 of the 25017 bytes are sent.