SimpleXMLRPCServer and socket

J

Juju

Hi,

First, sorry for my poor English !

I used the SimpleXMLRPCServer facility of Python to develop a
multithread-server, here's part of my code :
--
class TotoSimpleXMLRPCServer(SocketServer.ThreadingMixIn,
SimpleXMLRPCServer.SimpleXMLRPCServer):

def __init__(self, addr):
SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(self, addr,
SimpleXMLRPCServer.SimpleXMLRPCRequestHandler, 0)

def _dispatch(self, method, params):
if method == "toto58":
...
--

The problem I have, is I don't know how to get the port used by the
remote host ?

I tried to get this information with the socket object of the Server,
but this socket always correspond to the LISTENING socket and not the
ESTABLISHED one ! (With the lsof command, I see 2 connexions 1 LISTEN
and 1 ESTABLISHED).

So, when I tried to getpeername() on this object, I've an Exception
(107, 'Transport endpoint is not connected'), which is normal for a
listening connexion.

How can I get the socket object corresponding to the ESTABLISHED
connexion ? (Or how can I do to get the port of the remote host ?)

Thanks in advance...
Juju
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,733
Latest member
LonaMonzon

Latest Threads

Top