socket.recvfrom() & sendto()

Donn Cave donn at oz.net
Thu May 10 01:49:54 EDT 2001


Quoth "Steve Holden" <sholden at holdenweb.com>:
| "Donn Cave" <donn at u.washington.edu> wrote ...
[ ... piling misunderstanding on misunderstanding ... ]
| > 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.
|
| The term "connect" is misleading in terms of datagram services, since really
| there is no such thing as a "connection": datagrams get delivered to the
| port addressed in the datagram, and (if nothing goes wrong) the server will
| usually issue a reply to to the incoming source port, from the incoming
| destination port.

I just now had a chance to look at the Digital UNIX man page.
It turns out that connect() does mean something with datagram sockets:
it establishes a peer address that will be used with send(), and
causes any incoming datagrams from other addresses to be ignored.
It's obscure and rarely used, but I know of at least one application.

	Donn Cave, donn at oz.net



More information about the Python-list mailing list