1. Home
  2. Computing & Technology
  3. Python

Functions (Part 1)

by Al Lukaszewski
for About.com

Functions

Here is documentation in-depth on the functions available through the socket module.

    RAND_add(...)
        RAND_add(string, entropy)
        Mix string into the OpenSSL PRNG state. entropy (a float) is a lower
        bound on the entropy contained in string.
    RAND_egd(...)
        RAND_egd(path) -> bytes
        Queries the entropy gather daemon (EGD) on socket path. Returns number
        of bytes read. Raises socket.sslerror if connection to EGD fails or
        if it does provide enough data to seed PRNG.
    RAND_status(...)
        RAND_status() -> 0 or 1
        Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not.
        It is necessary to seed the PRNG with RAND_add() on some platforms before
        using the ssl() function.
    fromfd(...)
        fromfd(fd, family, type[, proto]) -> socket object
        Create a socket object from a duplicate of the given
        file descriptor.
        The remaining arguments are the same as for socket().
    getaddrinfo(...)
        getaddrinfo(host, port [, family, socktype, proto, flags])
            -> list of (family, socktype, proto, canonname, sockaddr)
        Resolve host and port into addrinfo struct.
    getdefaulttimeout(...)
        getdefaulttimeout() -> timeout
        Returns the default timeout in floating seconds for new socket objects.
        A value of None indicates that new socket objects have no timeout.
        When the socket module is first imported, the default is None.
    getfqdn(name='')
        Get fully qualified domain name from name.
        An empty argument is interpreted as meaning the local host.
        First the hostname returned by gethostbyaddr() is checked, then
        possibly existing aliases. In case no FQDN is available, hostname
        as returned by gethostname() is returned.
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 3>

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

All rights reserved.