1819800 Members
3051 Online
109607 Solutions
New Discussion юеВ

Error EWOULDBLOCK

 
SOLVED
Go to solution
Jolivet
Occasional Contributor

Error EWOULDBLOCK

When using send() to write data in a socket, the error EWOULDBLOCK appears if there is no space in the system to buffer any of the data.

Is it possible, by configuration of the kernel or something else, to increase the size of the buffer, to reduce the occurrence of this error.

Michel
2 REPLIES 2
Clemens van Everdingen
Honored Contributor

Re: Error EWOULDBLOCK

Hi,

I would like to know which version of s700_800 11.00 cumulative ARPA Transport patch you have on your system.

I believe there was an issue with this and is resolved as from patch PHNE_17662

C.
The computer is a great invention, there are as many mistakes as ever, but they are nobody's fault !
Steven Gillard_2
Honored Contributor
Solution

Re: Error EWOULDBLOCK

You can increase it up to 256k inside the application by calling setsockopt() as follows:

int qsize = 262140, arglen = sizeof(int);
setsockopt(socket, SOL_SOCKET, SO_SNDBUF, &qsize, arglen);

You'll want to check the return code is not -1 in case this fails for some reason. Man setsockopt for more details.

Note that no matter how high you set the buffer size you're still going to get hit with the EWOULDBLOCK error, this is perfectly normal when using non-blocking sockets. You have to code your application to handle this condition. The best way is to use select() to tell you when the socket is ready to send to.

Regards,
Steve