Accept/Send Network Data Concurrently?

Chris Armstrong punck at SpamIsBadPenguinPowered.com
Thu Mar 16 20:13:56 EST 2000


I was querying just a day or two ago about a chat system type thing on this news
group. (If you want to find it, the thread's subject was "Chat system") Anyway,
I was pointed in the direction of select.select() - you use it in an infinite loop, and
it checks multiple file descriptors for any new data, and then you
handle that data with your own code. If there's no new data on any of the fd's you
tell it to look at, then it blocks until there is some.

Also, you should check out PyGCS, it's a simple chat server that uses that select()
thing. http://sourceforge.net/project/?form_grp=378

In article <8arqi0$ope$1 at news.kersur.net>, lf11 at deletethistomailme.andonet.com wrote:
> This is a puzzle that has stumped me for some time--how can I 
> make server that accepts incoming requests, replies to them, 
> and sends data at timed intervals?
> 
> For example, a chat server that accepts incoming requests 
> and forwards them to the appropriate user.  It also maintains 
> a list of online users, and pings them periodically to see if 
> they are still on.
> 
> Thanks!
> 
>  -lf

-- 
Chris Armstrong
http://drol.sourceforge.net

Geek code version 3.12
GCS d? s:-- a--- C+++ UL++++>++++ P++ L+++ E--- W++ N+ o? K- w-- 
O-- !M V PS+(+++) PE? Y+(--) PGP(--) t+ 5 X+ R tv+ b+>++ DI+ D+++ 
G e- h!(--) r- y?
Go to www.geekcode.com to find out what on earth this is.




More information about the Python-list mailing list