How to recive more than 65000 bytes in C++ socket using recv()
Posted
by
Mr.Cool
on Stack Overflow
See other posts from Stack Overflow
or by Mr.Cool
Published on 2012-03-29T06:31:13Z
Indexed on
2012/04/03
11:30 UTC
Read the original article
Hit count: 280
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 65,635
bytes only.
How can I send the entire bytes without loss?
Following is my code at server side.
//Receive the message from client socket
if((iByteCount = recv(GetSocketId(), buffer, MAXRECV, MSG_WAITALL)) > 0)
{
printf("\n Received bytes %d\n", iByteCount);
SetReceivedMessage(buffer);
return LS_RESULT_OK;
}
If I use MSG_WAITALL
it takes a long time to receive the bytes so how can I set the flag to receive more than 10
lakhs bytes at time.
© Stack Overflow or respective owner