I am developing a client server application (TCP) in Linux using C++. I want to send more than 65,000
bytes at the same time. In TCP, the maximum packet size is
I would suggest exploring kqueue or something similar. With event notification there is no need to loop on recv
. Just call a simple read function upon an EV_READ
event and use a single call to the recv
function upon the socket that triggered the event. Your function can have a buffer size of 10 bytes or however much you want it doesn't matter because if you did not read the entire message the first time around you'll just get another EV_READ event on the socket and you recall your read function. When the data is read you'll get a EOF event. No need to hustle with loops that may or may not block other incoming connections.