J
Jeremy Monnet
Hello,
I've started python a few weeks ago, and to now everything went fine
with my cookbook and a learning book.
Now, I've tried the SimpleXMLRPCServer, and it worked OK untill I
tried to get the client IP address. I have searched a long time the
Internet but couldn't find a _simple_ solution
#Code
from liste_films import *
import SimpleXMLRPCServer
def isOpen():
# Here I want to get the clien IP address
if CheckPerms(IP):
return True
else:
return False
if __name__ == '__main__':
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8000))
server.register_function(isOpen)
server.serve_forever()
#end code
Tips I've found were :
- inherit from requestDispatcher and overload its methods. But that's
not that Simple.
- use the requestHandler and its method address_string(), but I didn't
an easy to understand example
- http://mail.python.org/pipermail/python-list/2006-May/340266.html
but this thread seems not to have been finished :-(
Furthermore, I think I should be able to access the socket object from
where I am (at starting of isOpen() ), but I don't know how. "self"
and "parent" are not defined, I can access the "server" object, but it
says the other end s not connected ("transport endpoint"). I think
this SimpleXMLRPCServer was not threaded (because it says in the API :
"answer all requests one at a time"), so I don't understand why in the
middle of my function the server.socket.getpeername() says it's not
connected.
I'm using python2.3 on linux (debian sid).
Thanks for any help !
Jeremy
I've started python a few weeks ago, and to now everything went fine
with my cookbook and a learning book.
Now, I've tried the SimpleXMLRPCServer, and it worked OK untill I
tried to get the client IP address. I have searched a long time the
Internet but couldn't find a _simple_ solution
#Code
from liste_films import *
import SimpleXMLRPCServer
def isOpen():
# Here I want to get the clien IP address
if CheckPerms(IP):
return True
else:
return False
if __name__ == '__main__':
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8000))
server.register_function(isOpen)
server.serve_forever()
#end code
Tips I've found were :
- inherit from requestDispatcher and overload its methods. But that's
not that Simple.
- use the requestHandler and its method address_string(), but I didn't
an easy to understand example
- http://mail.python.org/pipermail/python-list/2006-May/340266.html
but this thread seems not to have been finished :-(
Furthermore, I think I should be able to access the socket object from
where I am (at starting of isOpen() ), but I don't know how. "self"
and "parent" are not defined, I can access the "server" object, but it
says the other end s not connected ("transport endpoint"). I think
this SimpleXMLRPCServer was not threaded (because it says in the API :
"answer all requests one at a time"), so I don't understand why in the
middle of my function the server.socket.getpeername() says it's not
connected.
I'm using python2.3 on linux (debian sid).
Thanks for any help !
Jeremy