'Java net.Socket : how to change tcp window size to increase file transfer speed

I'm making an ftp like server/client application based on TCP (for self educational purposes) but the file transfer speed is extremely slow (around 500kb/s on localhost), I believe this is due to the server waiting an ACK from the client before sending the next packet, as I have red you can change the TCP window size (please correct me if I'm wrong), I have tried for many hours without any results is there a way before I start considering UDP? enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source