1. Home
  2. Computing & Technology
  3. Python

Classes: socket (Part 4)

by Al Lukaszewski
for About.com

    socket = class _socketobject(__builtin__.object)
            setblocking(flag)
            
            Set the socket to blocking (flag is true) or non-blocking (false).
            setblocking(True) is equivalent to settimeout(None);
            setblocking(False) is equivalent to settimeout(0.0).
        setsockopt(self, *args)
            setsockopt(level, option, value)
            
            Set a socket option. See the Unix manual for level and option.
            The value argument can either be an integer or a string.
        settimeout(self, *args)
            settimeout(timeout)
            
            Set a timeout on socket operations. 'timeout' can be a float,
            giving in seconds, or None. Setting a timeout of None disables
            the timeout feature and is equivalent to setblocking(1).
            Setting a timeout of zero is the same as setblocking(0).
        shutdown(self, *args)
            shutdown(flag)
            
            Shut down the reading side of the socket (flag == SHUT_RD), the writing side
            of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).
        Data and other attributes defined here:
        __slots__ = ['_sock', 'send', 'recv', 'sendto', 'recvfrom', '__weakref...
        __weakref__ = <attribute '__weakref__' of '_socketobject' objects>
            list of weak references to the object (if defined)
        recv = <member 'recv' of '_socketobject' objects>
        recvfrom = <member 'recvfrom' of '_socketobject' objects>
        send = <member 'send' of '_socketobject' objects>
        sendto = <member 'sendto' of '_socketobject' objects>
    class sslerror(error)
        Method resolution order:
            sslerror
            error
            exceptions.Exception
        Methods inherited from exceptions.Exception:
        __getitem__(...)
        __init__(...)
        __str__(...)
    class timeout(error)
        Method resolution order:
            timeout
            error
            exceptions.Exception
        Methods inherited from exceptions.Exception:
        __getitem__(...)
        __init__(...)
        __str__(...)
Explore Python
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Python
  4. Networking
  5. Python Network Programming : Python's socket Module - Part 2>

©2009 About.com, a part of The New York Times Company.

All rights reserved.