socket.recvfrom() & sendto()

Ron Johnson ron.l.johnson at home.com
Mon May 7 17:59:28 EDT 2001


Donn Cave wrote:

> 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.

So my fundamental question is: how does select() support multiple
non-blocking TCP sockets, when you can only bind 1 socket to a port?

I hope these don't sound like stupid questions, but as a hobbiest,
I can't afford to buy Programming Python, 2nd Edition ($44 after 
B&N's 20% discount) and Stevens' UNIX Network Programming, 2nd Ed 
($68 - no discount)

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