Determine local socket IP address per request

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Determine local socket IP address per request

adam-5
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Loading...