What does “No anode” mean in errno 55 when socket connection fails?
Polytropon
freebsd at edvax.de
Tue Dec 29 20:09:50 UTC 2020
On Tue, 29 Dec 2020 13:53:24 -0500, Kevin P. Neal wrote:
> On Sun, Dec 27, 2020 at 11:03:17PM +0530, Rahul Bharadwaj wrote:
> > I was doing a few performance tests on a local server and once in a while I
> > hit an error where opening a socket connection fails.
> >
> > i.e. considering the simplest code:
> >
> > #include <errno.h>
> > #include <sys/socket.h>
> >
> > int main() {
> > /* code to create socket object */
> >
> > int ret = connect(sock, (struct sockaddr *)&serv_addr,
> > sizeof(serv_addr));
> > if (ret < 0) {
> > fprintf(stderr, "connect() failed with: %d\n", errno); // <---- *get
> > errno as 55*
> > exit(1);
> > }
> > /* other code */
> > }
> >
> > There is no explanation for this error number "55". In every place, the
> > only mention is "No anode". There is no mention of what "anode" means and
> > what "No anode" specifically means.
> >
> > Can someone please help me with what this errno means or point me to some
> > documentation explaining the same.
>
> Call strerror(errno) to get a char* that describes what the various errno
> values mean. Pass that char* to fprintf with the usual "%s" format string.
Or use perror(), which technically does the same thing (and
allows you to add a custom error message prefix):
The perror() function finds the error message corresponding to the cur-
rent value of the global variable errno (intro(2)) and writes it, fol-
lowed by a newline, to the standard error file descriptor. If the argu-
ment string is non-NULL and does not point to the null character, this
string is prepended to the message string and separated from it by a
colon and space (``: ''); otherwise, only the error message string is
printed.
See "man 3 perror" for details.
There is also a perror program, which can be used to check:
% perror 55
No buffer space available
See "man 1 perror" for details respectively.
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions
mailing list