socket.recvfrom() & sendto()

Donn Cave donn at u.washington.edu
Mon May 7 14:58:21 EDT 2001


Quoth Ron Johnson <ron.l.johnson at home.com>:

| Can these be used by a server process that wants to simultaneous 
| keep sockets open to multiple clients?
|
| 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.

Per your later clarification, not really!  A client can connect()
to a datagram service, but to my knowledge that makes no difference
on the server end.

Now of course recvfrom() returns the address of the sender, so
it's possible to deal with the incoming data in the context of a
history of multiple clients.  Or your server can bind another
address for each new client, and notify the client to use that.
But for features like "connection closed", you would want a TCP
stream.

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list