0

When I try to bind a socket using linux bind call. it return error 63 (Out of streams resources). I tried to explore (using google) why this error is coming and how to reproduce it but I had no luck. This problem is happening at one of the setup where I do not have direct access. I want to understand why this error is coming and want to recreate the problem. I am using Opensuse linux.

Any help would be really appreciable.

Thangaraj
  • 3,038
  • 7
  • 40
  • 43
  • 1
    Depending on your flavor of Linux, error 63 might be ENAMETOOLONG instead of ENOSR. Is that a possibility? – Jim Garrison Oct 16 '12 at 07:05
  • 2
    Also, if that's 0x63 and not decimal, then it's error 99 EADDRNOTAVAIL, which would make _much_ more sense in a call to `bind()`. – Jim Garrison Oct 16 '12 at 07:07
  • @JimGarrison I am using Suse Linux and this is the errno value. So I believe this value should be integer. The value in errno.h file is #define ENOSR 63 /* Out of streams resources */Kindly correct me if I am wrong. Thxn. – Thangaraj Oct 16 '12 at 07:22
  • 3
    Yes, on SUSE 63 is ENOSR. Do you know what the parameters are to the `bind()` call? How do you _know_ the error you are getting back is decimal and not 0x63. – Jim Garrison Oct 16 '12 at 07:30
  • 1
    @JimGarrison Thanks JimGarrison, the value is 0x63. It is hex value not decimal value. – Thangaraj Oct 17 '12 at 07:25

1 Answers1

2

Error 0x63 is EADDRNOTAVAIL, which means you're trying to bind to an address that's already in use. Make sure you are not already running an instance of your program (which would have bound the port), and that there's not something else using the port.

The command

netstat -nat 

will tell you if the port is in use. If you have root access you can add an option (-p on linux) that will also tell you which process has the port open.

There's also the lsof and/or fuser commands (depending on your flavor of Linux/Unix) to list open file handles and the owning processes. These also require root or sudo access.

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190