inter threading info

Daniel Dittmar daniel.dittmar at sap.corp
Wed Mar 23 15:46:05 CET 2005

Tertius Cronje wrote:

> Q: Is it possible for a thread on SocketServer.ThreadingTCPServer to get
> the socket info of *other* open thread/s and use that info to send data
> to the accepting client?

A specific socket can be used from every thread of a process. Just make 
sure that you synchronize everything.

> I need to create a client that can connect to server and then determine
> how many other clients are connected, what the socket info is

When you accept a socket client, a new socket is created, so you cannot 
determine how many clients are connected to a socket. You have to create 
a data structure where you insert info about accepted connections and 
delete the info when a connection is closed.

> (ifile/ofile) and then send and receive specific data to those clients. 

ifile/ofile are local to the server process so you cannot use them to 
send data from one client to another client. You have to send the data 
to the server first with a special tag, the server has to use that tag 
and send the data to the designated other client.

It sounds a bit as if you want to build some kind of chat server and now 
you want to add private channels.


More information about the Python-list mailing list