I am using Sockets in C# and have gotten to the point where I want to send a file through the connection. I have the server send a file to the client by reading a chunk of the file and sending that data, and it keeps doing this until the entire file is sent. Than on the client side it just collects and writes the data to the file until it gets all of the data.
However the problem is that this uses 100% cpu usage. The 100% is split between 3 processors, the server, client, and system (server and client are ran on the same computer). I have tried different buffer sizes including 256 bytes, 1024 bytes, 8096 bytes, and even 25000 bytes and they all give the same cpu usage. I have determined that it is indeed the send and recv commands that do it and not the file reading and writing.
So does anyone have a solution for this?