I have a C# client/server network program I've written using TCPListener and TCPClient classes. The server is reading everything from the client (small amounts of xml) just fine until I try to send a large file (100k) back to the client.
I'm using stream functions for both client and server with non-blocking socket functions. When I do a socket.SendFile("filename") back to the client, the file is getting cut off - I've set the receive buffer size on the client to well past 100k but it still gets cut off around 25k and the communication between client and server is unreliable afterwords.
My basic question is what happens if data is somehow left in the pipe ? i.e.. will it be read by the next socket.Read... Does every Send call require exactly one and only one Read ? Maybe I'm not giving the client enough time to read the file but their both on the same machine and I've tried sleeping for a few seconds in various places w/o success.