How to determine server's own IP address? inet_server_addr not working

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to determine server's own IP address? inet_server_addr not working

Guyren Howe
The documentation says that inet_server_addr() does this, but on our servers it is returning nothing.
Reply | Threaded
Open this post in threaded view
|

Re: How to determine server's own IP address? inet_server_addr not working

David G Johnston
On Sun, Feb 21, 2021 at 4:38 PM Guyren Howe <[hidden email]> wrote:
The documentation says that inet_server_addr() does this, but on our servers it is returning nothing.

"Returns the IP address on which the server accepted the current connection, or NULL if the current connection is via a Unix-domain socket."

You will need to demonstrate that the connection you are checking from isn't being made via a Unix-domain socket.

David J.

Reply | Threaded
Open this post in threaded view
|

Re: How to determine server's own IP address? inet_server_addr not working

Ian Lawrence Barwick

2021年2月22日(月) 8:42 David G. Johnston <[hidden email]>:
On Sun, Feb 21, 2021 at 4:38 PM Guyren Howe <[hidden email]> wrote:
The documentation says that inet_server_addr() does this, but on our servers it is returning nothing.

"Returns the IP address on which the server accepted the current connection, or NULL if the current connection is via a Unix-domain socket."

You will need to demonstrate that the connection you are checking from isn't being made via a Unix-domain socket.

Note also there's a bug in current versions where this function will erroneously
return NULL if executed by a parallel worker, see [1]. This is fixed in HEAD but
hasn't been backpatched [2].



Regards

Ian Barwick

--