I am suddenly getting the following error when I execute perror() follwing a failed send.
I have never seen such a message .Code:send: Resource temporarily unavailable
Printable View
I am suddenly getting the following error when I execute perror() follwing a failed send.
I have never seen such a message .Code:send: Resource temporarily unavailable
Well the "temporarily" suggests you should wait a short while and try again.
Just hope that was not meant to be funny.. Had tried for about 10 mins before posting it here.
So does that mean if you stop the program and restart it, then all is well for a while before it persistently displays that message?
Well, actually, for this particular send(), I have to use a TIPC socket. I get this message for the first send() call that is made. I am 90% sure of that. The code is actually too huge and I am using sockets of the TCP family to transfer control information until I get into this module.
I must have called send()/recv() on a TIPC socket hundreds of times over the last one month, never faced this problem before.Does it have to do with some option in setsockopt?
TIPC is this? - http://tipc.sourceforge.net/
Never used it, so I'm just guessing.
> http://www.linuxmanpages.com/man3/errno.3.php
EAGAIN decodes to the message "Resource temporarily unavailable"
> http://www.linuxmanpages.com/man2/send.2.php
EAGAIN or EWOULDBLOCK means The socket is marked non-blocking and the requested operation would block.
The socket options could be worth looking into, maybe it's non-blocking for some reason.
> and I am using sockets of the TCP family to transfer control information until I get into this module.
A concurrent access problem perhaps?
Something else already has this particular socket, so trying to use it from here causes problems?
>concurrent access problem perhaps?
Even I just thought so. I guess its a race condition. Will force one thread to wait for some time and see if it makes any difference.
I am actually using the POLLING mode and after a lot of thorough checking, i have found out that this socket descriptor isnt being used anywhere else. I have no clue whats going on here. Guess will just have to wait for my guide to get back :|
Well, The socket that I was using had been set to Non-blocking mode using fcntl() and I didnt know that. I tried the non-blocking socket using simple TCP -SOCK_STREAM socket in a simple program. I have set the sender to sleep for 5 s before calling send() and predictably, the recv() call returned with :
This is because there is no data to be read and the matching send is yet to be called.Code:recv: Resource temporarily unavailable
But, going back to my original question, the reason why send gave me that error, still beats me. And my code actually works when I dont set the socket to non-blocking.