I have a Tornado server that listens on both an address/port, and on a socket. I create the server roughly like so (stripped down heavily):
from tornado import httpserver
from tornado.netutil import bind_unix_socket
server = httpserver.HTTPserver(
unix_socket = bind_unix_socket("mysock.sock")
curl -XGET --unix-socket mysock.sock http:/ping
localhost is an internet-domain interface with a well-known IP address. It's not the same as a unix-domain socket, which has no IP address.
A brief look at the source suggests that the
remote_ip attribute will contain
'0.0.0.0' for a connection received on the unix socket.
remote_ip would presumably be
'127.0.0.1' for a connection received via a localhost connection.)