The socket Module (cont)

The socket(family, type, proto) function

  • Creates a new socket object.
  • family is usually set to AF_INET
  • type is one of:
     SOCK_STREAM         Stream socket (TCP)
     SOCK_DGRAM          Datagram socket (UDP)
     SOCK_RAW            Raw socket
  • proto is usually only used with raw sockets
     IPPROTO_ICMP
     IPPROTO_IP
     IPPROTO_RAW
     IPPROTO_TCP
     IPPROTO_UDP

Comments

  • Currently no support for IPv6 (although its on the way).
  • Raw sockets only available to processes running as root.
<<< O'Reilly OSCON 2000, Advanced Python Programming, Slide 89
July 17, 2000, beazley@cs.uchicago.edu
>>>