[Twisted-Python] client-server communication + ssl + wxpython: newbie question, help please

Rene Dudfield illumen at yahoo.com
Mon Jul 21 06:54:35 EDT 2003


Ruslan Spivak wrote:

> Hello, twisted users!
>
> I'm newbie to twisted and after reading documentation feel somewhat a 
> little bit confused, don't know where to start.
> Can you give an advice on the following:
>
> I need to have a server and a GUI client(wxpython), which communicates 
> using ssl.
> Server:
>    - it should take requests for establishing connection from a lot of 
> GUI clients using ssl
>    - the request for connection method will pass to server simple 
> types (strings and dicts)
>    - server will ask radius  server if such user exists, and if so 
> then it writes some info to database(MySQL) and adds some rules to 
> firewall. If such user doesn't exist in radius, then it raises 
> exception to remote client or just return error code.
>    - If client succeded in connection, then server should every 3 
> minutes call method 'checkpoint' on client. If it doesn't receive 
> response from client, it deletes rules from firewall and writes some 
> info to database.
>
> Client:
>     - wxpython gui based client, that tries to connect to remote 
> server using ssl(Connection means connecting to some port on the 
> server, passing parameters to remote method 'connect' and if there is 
> no exception or return code == 1, connection is successfull and 
> message printed to happy user).
>     - client contains method that will be periodically(each 3 minutes) 
> called by server after successful connection
>
> I just don't know where to start. Should client implement Root.pb as 
> from Chapter 5(Perspective broker), so that it can pass reference to 
> server and server can call methods on it or maybe i need implement 
> some protocol? And how ssl fits in all this? Is it high-level or 
> low-level twisted to impelemt features i've described?
> Thanks in advance.
> Your help is very, very appreciated.
>
> Best regards,
> Ruslan
>
The way I got the listening peer(the server) to be able to make calls to 
the connecting one(client) was to do what you describe.  Return a 
subclass of pb.Root to a method on the server which stores that 
somewhere where it can make calls to it later.

I think you can use listenSSL instead of listenTCP.  Haven't used it 
myself.  Have you looked in the examples, or tests directories?

If you have lots of clients, you may want to get them to disconnect so 
your server doesn't get overloaded.







More information about the Twisted-Python mailing list