Re: Learning Python in a group

2008-06-26 Thread Mr. Juju

Taygun Kekec wrote:

hi guys.

I would be glad to join your group because i want to learn deeper
python but i am frustrated of isolation too. It would provide
stimulation and encourage to study and will boost our desire to learn.
So count me in!


hello all,
I just started studying python myself and was looking for a group. I 
would be happy to join. Count me in. Email me with the details of how 
you guys want to do this. Cheers

--
http://mail.python.org/mailman/listinfo/python-list


Re: SimpleXMLRPCServer and socket

2006-09-26 Thread Juju
Hi,

2006/9/25, Fredrik Lundh <[EMAIL PROTECTED]>:
> I don't have time to dig deeper into this right now, but this post might
> be helpful:
>
> http://article.gmane.org/gmane.comp.python.general/471411

I tried to override the "verify_request" method, it managed to get the
ClientAddress, but in this method, the Server is not yet Multithreaded
so I couldn't detect which ClientAddress correspond to which Thread.

So I look more closely at the code (TCPServer, SimpleXMLRPCServer...)
and I finally manage to do what I wanted to do, with overriding the
"finish_request" method and storing the ClientAddresses in a dict
(with the Thread ID as the key) :

--
def finish_request(self, request, client_address):
  # Override the finish_request to collect the client address
  self.dictClientAddress[str(thread.get_ident())]=client_address
  SimpleXMLRPCServer.SimpleXMLRPCServer.finish_request(self, request,
client_address)
--

And now it works !

But I still have a little question :

How can I do to know which method I should override to make the things work ?

Usually, I look at "python.org" but in this case, I couldn't find what
I was looking for.
Finally, I had to look at the source files to understand what I should do.

Thanks in advance...
Ju

>
> (if not, follow up to c.l.python)
>
> cheers /F
>
-- 
http://mail.python.org/mailman/listinfo/python-list


SimpleXMLRPCServer and socket

2006-09-25 Thread 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
-- 
http://mail.python.org/mailman/listinfo/python-list