Date: Tue, 29 Dec 2020 21:09:45 +0100 From: Polytropon <freebsd@edvax.de> To: "Kevin P. Neal" <kpn@neutralgood.org> Cc: Rahul Bharadwaj <rahulbharadwajpromos@gmail.com>, freebsd-questions@freebsd.org Subject: Re: What does =?UTF-8?Q?=E2=80=9CNo_anode=E2=80=9D?= mean in errno 55 when socket connection fails? Message-ID: <20201229210945.74b0f682.freebsd@edvax.de> In-Reply-To: <X%2Bt7JOlYclMU3AVD@neutralgood.org> References: <CADotuvv-csH5L2E5OGkLTNOVJ2KYeU6q9Fp_n1Y%2BFwfiiJCPQA@mail.gmail.com> <X%2Bt7JOlYclMU3AVD@neutralgood.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20201229210945.74b0f682.freebsd>