Thread: A weird error message.

  1. #1
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342

    A weird error message.

    I am suddenly getting the following error when I execute perror() follwing a failed send.

    Code:
    send: Resource temporarily unavailable
    I have never seen such a message .
    In the middle of difficulty, lies opportunity

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well the "temporarily" suggests you should wait a short while and try again.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    Just hope that was not meant to be funny.. Had tried for about 10 mins before posting it here.
    In the middle of difficulty, lies opportunity

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    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?
    In the middle of difficulty, lies opportunity

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    >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.
    In the middle of difficulty, lies opportunity

  8. #8
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    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 :|
    In the middle of difficulty, lies opportunity

  9. #9
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    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 :
    Code:
    recv: Resource temporarily unavailable
    This is because there is no data to be read and the matching send is yet to be called.
    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.
    In the middle of difficulty, lies opportunity

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. weird things with my linked list of queue
    By -EquinoX- in forum C Programming
    Replies: 3
    Last Post: 11-22-2008, 11:23 PM
  2. weird
    By kiz in forum C Programming
    Replies: 8
    Last Post: 09-24-2007, 01:16 AM
  3. Weird Characters With GetDlgItemText
    By execute in forum Windows Programming
    Replies: 4
    Last Post: 05-04-2006, 04:53 PM
  4. weird error
    By gandalf_bar in forum Linux Programming
    Replies: 2
    Last Post: 07-17-2005, 07:32 AM
  5. Getting weird characters in Strings
    By steve8820 in forum C Programming
    Replies: 3
    Last Post: 09-18-2001, 02:49 AM