socket.recvfrom() & sendto()

Cary O'Brien cobrien at Radix.Net
Mon May 7 09:21:50 EDT 2001


In article <VFrJ6.35380$2U.14656610 at news2.rdc2.tx.home.com>,
Ron Johnson  <ron.l.johnson at home.com> wrote:
>Hello,
>
>Can these be used by a server process that wants to simultaneous 
>keep sockets open to multiple clients?
>

Sure.  You can have as many open sockets as you want (within
reason, i.e. hundreds [1].  With thousands of open connections
you may run into problems).

>The reason that I ask this is because, unlike with command/response
>client/server systems, the server must be able to send data to any
>client at any moment.  AIM/ICQ would be similar model, even though
>I am not writing a chat program.
>

Python provides a couple of libraries that will help.

       socket, select, SocketServer, and asyncore

are worth taking a look at.  

-- cary

[1] To be honest, I'm not sure where things break down.
20-30 sockets should be fine.  Hundreds should be fine
too.  In the thousands you may run into limits.  Unix
at least limits the max number of files a process can
have open.



>Sincerely,
>Ron
>-- 
> Ron Johnson, Jr.        Home: ron.l.johnson at home.com
> Jefferson, LA  USA      http://ronandheather.dhs.org
> "Is Python better or worse than Perl?"
>  "Perl is worse than Python because people wanted it 
>   worse." -Larry Wall, 10/14/1998





More information about the Python-list mailing list