How to make inet_server_addr() return localhost in spite of ::1/128
@cavila's answer in comments also answers the question "Why does select inet_server_addr() || '' return a result like 192.168.44.195/32?" 

inet is a data type. To suppress the number of bits and get a text IP like '192.168.51.195', use select(host(inet_server_addr())).