Socket Programming in Python

Josiah Carlson jcarlson at nospam.uci.edu
Fri Feb 20 06:15:24 CET 2004


 > from socket import *

is not required.  In fact, that leads to namespace pollution that may 
cause problems for users later.

Most socket applications that I've seen tend to use 'import socket', 
then refer to all the various constants by socket.AF_INET and such.

Another thing worth mentioning is that while UDP datagrams are useful 
when you don't care about your data, TCP streams tend to do what people 
expect (no information gets re-arranged, etc.).

  - Josiah



More information about the Python-list mailing list