1. Home
  2. Computing & Technology
  3. Python

Classes: SSLType, SocketType (Part 2)

by Al Lukaszewski
for About.com

    SSLType = class SSL(__builtin__.object)
    SocketType = class _socketobject(__builtin__.object)
        Methods defined here:
        __init__(self, family=2, type=1, proto=0, _sock=None)
        accept(self)
            accept() -> (socket object, address info)
            
            Wait for an incoming connection. Return a new socket representing the
            connection, and the address of the client. For IP sockets, the address
            info is a pair (hostaddr, port).
        bind(self, *args)
            bind(address)
            
            Bind the socket to a local address. For IP sockets, the address is a
            pair (host, port); the host must refer to the local host. For raw packet
            sockets the address is a tuple (ifname, proto [,pkttype [,hatype]])
        close(self)
            close()
            
            Close the socket. It cannot be used after this call.
        connect(self, *args)
            connect(address)
            
            Connect the socket to a remote address. For IP sockets, the address
            is a pair (host, port).
        connect_ex(self, *args)
            connect_ex(address) -> errno
            
            This is like connect(address), but returns an error code (the errno value)
            instead of raising an exception when an error occurs.
        dup(self)
            dup() -> socket object
            
            Return a new socket object connected to the same system resource.
        fileno(self, *args)
            fileno() -> integer
            
            Return the integer file descriptor of the socket.
        getpeername(self, *args)
            getpeername() -> address info
            
            Return the address of the remote endpoint. For IP sockets, the address
            info is a pair (hostaddr, port).
        getsockname(self, *args)
            getsockname() -> address info
            
            Return the address of the local endpoint. For IP sockets, the address
            info is a pair (hostaddr, port).
        getsockopt(self, *args)
            getsockopt(level, option[, buffersize]) -> value
            
            Get a socket option. See the Unix manual for level and option.
            If a nonzero buffersize argument is given, the return value is a
            string of that length; otherwise it is an integer.
        gettimeout(self, *args)
            gettimeout() -> timeout
            
            Returns the timeout in floating seconds associated with socket
            operations. A timeout of None indicates that timeouts on socket
            operations are disabled.
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. Python Library
  5. Python Network Programming : Python's socket Module - Part 1>

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

All rights reserved.