Determine local socket IP address per request

[email protected] Sun, 11 Jun 2017 05:20:35 -0700 (PDT)
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>
Hi,

I'm starting a cherrypy server bound to 0.0.0.0 on a machine that has 
multiple NICs.

Is there a way to determine the IP address of the NIC that was resposible 
for handling the request?

e.g., on a machine with two NICs with addresses (10.0.0.5, 192.168.1.20), 
requestes coming from 10.0.0.0/24 would show 10.0.0.5 as the IP of the NIC 
that processed the request.

I know that with low level sockets I can call getsockname() on the 
accept()ed socket to retrieve the address of the NIC.

- Adam

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.