I am using tcp socket server and client in c. Using AF_INET, SOCK_STREAM and IPPROTO_TCP
My send function in client side
sent_now = send(sockId, buffer + sent_total, len - sent_total, MSG_DONTWAIT);
When I send MSG up to size like 20K-40KB, It works fine. When I send MSG up to size like 365K (Thats what I need), I receive the following error in the server Side: Resource temporarily unavailable!
My receive function in server side
totalRecvMsgSize = recieve ( clntSocket, Buffer, RCVBUFSIZE , MSG_DONTWAIT);
I send int data type.
How can I receive all the array in one send and receive operation?
old post
There is a post What can cause a “Resource temporarily unavailable” on sock send() command, where Davide Berra says that
That's because you're using a non-blocking socket and the output buffer is full.
From the send() man page
When the message does not fit into the send buffer of the socket, send() normally blocks, unless the socket has been placed in non-block- ing I/O mode. In non-blocking mode it would return EAGAIN in this case.
EAGAIN is the error code tied to "Resource temporarily unavailable"
Consider using select() to get a better control of this behaviours
My question is:
*1) How can I receive all the array in one send and receive operation? *
2) does select() help me in this array size?
3) Can I change the buffer sizes and how?