Let me give you some context: I'm dealing with old code and trying to upload a binary file (~2MB) to an embedded microhttpd web server through an HTTP form (POST request). Recently, I've noticed that the upload speed is much slower from Windows 10 machines compared to non-Windows 10 machines. The upload process sends small chunks of data (about 6-7 chunks of ~1500 bytes each) and then pauses for 30-60 seconds before sending more data. This decrease in speed makes the whole upload process inefficient.
After debugging on the embedded server, I discovered that it was waiting for data on the socket created for the POST request, but the client machine wasn't sending the expected data. When I analyzed the traffic using Wireshark comparing Win10 to non-Win10 traffic, I found similarities with the issue described by Microsoft here: https://support.microsoft.com/en-gb/help/823764/slow-performance-occurs-when-you-copy-data-to-a-tcp-server-by-using-a.
In Windows 10, the first TCP packet sent to the embedded web server fills the entire socket send buffer in one call, as mentioned in the Microsoft article. This behavior is not observed in non-Windows 10 machines. Therefore, I need to adjust my socket settings so that the client doesn't overload the receive buffer with too much data in one packet.
Unfortunately, making significant changes to the web server itself is not feasible due to the tightly coupled and unstable legacy code. So, I'm exploring options to modify socket settings through JavaScript, if possible. I am currently using the JQuery Form plugin, which works with XMLHttpRequests. Since I have control over both the JavaScript page and the embedded web backend, I can manually set the socket buffer sizes in both cases.
Is there a way to configure low-level socket settings like this using JavaScript? If not, do you have any suggestions for resolving this issue?