# coding: utf-8 # AUTO-GENERATED FILE -- DO NOT EDIT # OVERRIDES FILE: static-pi-files/2.2/socketoverride.py """ This module provides socket operations and some related functions. On Unix, it supports IP (Internet Protocol) and Unix domain sockets. On other systems, it only supports IP. Functions specific for a socket are available as methods of the socket object. Functions: socket() -- create a new socket object socketpair() -- create a pair of new socket objects [*] fromfd() -- create a socket object from an open file descriptor [*] gethostname() -- return the current hostname gethostbyname() -- map a hostname to its IP number gethostbyaddr() -- map an IP number or hostname to DNS info getservbyname() -- map a service name and a protocol name to a port number getprotobyname() -- map a protocol name (e.g. 'tcp') to a number ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order htons(), htonl() -- convert 16, 32 bit int from host to network byte order inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89) ssl() -- secure socket layer support (only available if configured) socket.getdefaulttimeout() -- get the default timeout value socket.setdefaulttimeout() -- set the default timeout value create_connection() -- connects to an address, with an optional timeout and optional source address. [*] not available on all platforms! Special objects: SocketType -- type object for socket objects error -- exception raised for I/O errors has_ipv6 -- boolean value indicating if IPv6 is supported Integer constants: AF_INET, AF_UNIX -- socket domains (first argument to socket() call) SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument) Many other constants may be defined; these may be used in calls to the setsockopt() and getsockopt() methods. """ AF_APPLETALK = 16 AF_DECnet = 12 AF_INET = 2 AF_INET6 = 30 AF_IPX = 23 AF_ROUTE = 17 AF_SNA = 11 AF_UNIX = 1 AF_UNSPEC = 0 AI_ADDRCONFIG = 1024 AI_ALL = 256 AI_CANONNAME = 2 AI_DEFAULT = 1536 AI_MASK = 5127 AI_NUMERICHOST = 4 AI_NUMERICSERV = 4096 AI_PASSIVE = 1 AI_V4MAPPED = 2048 AI_V4MAPPED_CFG = 512 CAPI = None EAI_ADDRFAMILY = 1 EAI_AGAIN = 2 EAI_BADFLAGS = 3 EAI_BADHINTS = 12 EAI_FAIL = 4 EAI_FAMILY = 5 EAI_MAX = 15 EAI_MEMORY = 6 EAI_NODATA = 7 EAI_NONAME = 8 EAI_OVERFLOW = 14 EAI_PROTOCOL = 13 EAI_SERVICE = 9 EAI_SOCKTYPE = 10 EAI_SYSTEM = 11 EBADF = 9 EINTR = 4 INADDR_ALLHOSTS_GROUP = 3758096385 INADDR_ANY = 0 INADDR_BROADCAST = 4294967295 INADDR_LOOPBACK = 2130706433 INADDR_MAX_LOCAL_GROUP = 3758096639 INADDR_NONE = 4294967295 INADDR_UNSPEC_GROUP = 3758096384 IPPORT_RESERVED = 1024 IPPORT_USERRESERVED = 5000 IPPROTO_AH = 51 IPPROTO_DSTOPTS = 60 IPPROTO_EGP = 8 IPPROTO_EON = 80 IPPROTO_ESP = 50 IPPROTO_FRAGMENT = 44 IPPROTO_GGP = 3 IPPROTO_GRE = 47 IPPROTO_HELLO = 63 IPPROTO_HOPOPTS = 0 IPPROTO_ICMP = 1 IPPROTO_ICMPV6 = 58 IPPROTO_IDP = 22 IPPROTO_IGMP = 2 IPPROTO_IP = 0 IPPROTO_IPCOMP = 108 IPPROTO_IPIP = 4 IPPROTO_IPV4 = 4 IPPROTO_IPV6 = 41 IPPROTO_MAX = 256 IPPROTO_ND = 77 IPPROTO_NONE = 59 IPPROTO_PIM = 103 IPPROTO_PUP = 12 IPPROTO_RAW = 255 IPPROTO_ROUTING = 43 IPPROTO_RSVP = 46 IPPROTO_TCP = 6 IPPROTO_TP = 29 IPPROTO_UDP = 17 IPPROTO_XTP = 36 IPV6_CHECKSUM = 26 IPV6_JOIN_GROUP = 12 IPV6_LEAVE_GROUP = 13 IPV6_MULTICAST_HOPS = 10 IPV6_MULTICAST_IF = 9 IPV6_MULTICAST_LOOP = 11 IPV6_RECVTCLASS = 35 IPV6_RTHDR_TYPE_0 = 0 IPV6_TCLASS = 36 IPV6_UNICAST_HOPS = 4 IPV6_V6ONLY = 27 IP_ADD_MEMBERSHIP = 12 IP_DEFAULT_MULTICAST_LOOP = 1 IP_DEFAULT_MULTICAST_TTL = 1 IP_DROP_MEMBERSHIP = 13 IP_HDRINCL = 2 IP_MAX_MEMBERSHIPS = 4095 IP_MULTICAST_IF = 9 IP_MULTICAST_LOOP = 11 IP_MULTICAST_TTL = 10 IP_OPTIONS = 1 IP_RECVDSTADDR = 7 IP_RECVOPTS = 5 IP_RECVRETOPTS = 6 IP_RETOPTS = 8 IP_TOS = 3 IP_TTL = 4 MSG_CTRUNC = 32 MSG_DONTROUTE = 4 MSG_DONTWAIT = 128 MSG_EOR = 8 MSG_OOB = 1 MSG_PEEK = 2 MSG_TRUNC = 16 MSG_WAITALL = 64 class MethodType(object): """ instancemethod(function, instance, class) Create an instance method object. """ im_class = None im_func = None im_self = None NI_DGRAM = 16 NI_MAXHOST = 1025 NI_MAXSERV = 32 NI_NAMEREQD = 4 NI_NOFQDN = 1 NI_NUMERICHOST = 2 NI_NUMERICSERV = 8 def RAND_add(string, entropy): """ RAND_add(string, entropy) Mix string into the OpenSSL PRNG state. entropy (a float) is a lower bound on the entropy contained in string. See RFC 1750. """ pass def 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. """ return None SHUT_RD = 0 SHUT_RDWR = 2 SHUT_WR = 1 SOCK_DGRAM = 2 SOCK_RAW = 3 SOCK_RDM = 4 SOCK_SEQPACKET = 5 SOCK_STREAM = 1 SOL_IP = 0 SOL_SOCKET = 65535 SOL_TCP = 6 SOL_UDP = 17 SOMAXCONN = 128 SO_ACCEPTCONN = 2 SO_BROADCAST = 32 SO_DEBUG = 1 SO_DONTROUTE = 16 SO_ERROR = 4103 SO_KEEPALIVE = 8 SO_LINGER = 128 SO_OOBINLINE = 256 SO_RCVBUF = 4098 SO_RCVLOWAT = 4100 SO_RCVTIMEO = 4102 SO_REUSEADDR = 4 SO_REUSEPORT = 512 SO_SNDBUF = 4097 SO_SNDLOWAT = 4099 SO_SNDTIMEO = 4101 SO_TYPE = 4104 SO_USELOOPBACK = 64 SSL_ERROR_EOF = 8 SSL_ERROR_INVALID_ERROR_CODE = 10 SSL_ERROR_SSL = 1 SSL_ERROR_SYSCALL = 5 SSL_ERROR_WANT_CONNECT = 7 SSL_ERROR_WANT_READ = 2 SSL_ERROR_WANT_WRITE = 3 SSL_ERROR_WANT_X509_LOOKUP = 4 SSL_ERROR_ZERO_RETURN = 6 SocketType = _socketobject def StringIO(s=None): """ StringIO([s]) -- Return a StringIO-like stream for reading or writing """ return "" TCP_KEEPCNT = 258 TCP_KEEPINTVL = 257 TCP_MAXSEG = 2 TCP_NODELAY = 1 _GLOBAL_DEFAULT_TIMEOUT = None __all__ = [] class _closedsocket(object): def _dummy(self): pass def recv(self): pass def recv_into(self): pass def recvfrom(self): pass def recvfrom_into(self): pass def send(self): pass def sendto(self): pass _delegate_methods = () class _fileobject(object): """ Faux file object attached to a socket object. """ def __init__(self): pass _close = None def _getclosed(self): pass _rbuf = None _rbufsize = None _sock = None _wbuf = None _wbuf_len = None _wbufsize = None bufsize = None def close(self): pass closed = property(None, None, None, """ True if the file is closed """ ) default_bufsize = 8192 def fileno(self): pass def flush(self): pass mode = None name = '' def next(self): pass def read(self, size): pass def readline(self, size): pass def readlines(self, sizehint): pass softspace = None def write(self, data): pass def writelines(self, list): pass _m = 'shutdown' _realsocket = socket _socket = None _socketmethods = () class _socketobject(object): """ socket([family[, type[, proto]]]) -> socket object Open a socket of the given type. The family argument specifies the address family; it defaults to AF_INET. The type argument specifies whether this is a stream (SOCK_STREAM, this is the default) or datagram (SOCK_DGRAM) socket. The protocol argument defaults to 0, specifying the default protocol. Keyword arguments are accepted. A socket object represents one endpoint of a network connection. Methods of socket objects (keyword arguments not allowed): accept() -- accept a connection, returning new socket and client address bind(addr) -- bind the socket to a local address close() -- close the socket connect(addr) -- connect the socket to a remote address connect_ex(addr) -- connect, return an error code instead of an exception dup() -- return a new socket object identical to the current one [*] fileno() -- return underlying file descriptor getpeername() -- return remote address [*] getsockname() -- return local address getsockopt(level, optname[, buflen]) -- get socket options gettimeout() -- return timeout or None listen(n) -- start listening for incoming connections makefile([mode, [bufsize]]) -- return a file object for the socket [*] recv(buflen[, flags]) -- receive data recv_into(buffer[, nbytes[, flags]]) -- receive data (into a buffer) recvfrom(buflen[, flags]) -- receive data and sender's address recvfrom_into(buffer[, nbytes, [, flags]) -- receive data and sender's address (into a buffer) sendall(data[, flags]) -- send all data send(data[, flags]) -- send data, may not send all of it sendto(data[, flags], addr) -- send data to a given address setblocking(0 | 1) -- set or clear the blocking I/O flag setsockopt(level, optname, value) -- set socket options settimeout(None | float) -- set or clear the timeout shutdown(how) -- shut down traffic in one or both directions [*] not available on all platforms! """ def __init__(self, family=None, type=None, proto=None): return SocketType() _sock = None def 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). """ return (SocketType(), None) def bind(self, address): """ 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]]) """ pass def close(self, _closedsocket, _delegate_methods, setattr): """ close() Close the socket. It cannot be used after this call. """ pass def connect(self, address): """ connect(address) Connect the socket to a remote address. For IP sockets, the address is a pair (host, port). """ pass def connect_ex(self, address): """ 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. """ return None def dup(self): """ dup() -> socket object Return a new socket object connected to the same system resource. """ return SocketType() family = property(None, None, None, """ the socket family """ ) def fileno(self): """ fileno() -> integer Return the integer file descriptor of the socket. """ return 1 def getpeername(self): """ getpeername() -> address info Return the address of the remote endpoint. For IP sockets, the address info is a pair (hostaddr, port). """ return None def getsockname(self): """ getsockname() -> address info Return the address of the local endpoint. For IP sockets, the address info is a pair (hostaddr, port). """ return None def getsockopt(self, level, option, buffersize=None): """ 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. """ return None def gettimeout(self): """ gettimeout() -> timeout Returns the timeout in seconds (float) associated with socket operations. A timeout of None indicates that timeouts on socket operations are disabled. """ return None def listen(self, backlog): """ listen(backlog) Enable a server to accept connections. The backlog argument must be at least 0 (if it is lower, it is set to 0); it specifies the number of unaccepted connections that the system will allow before refusing new connections. """ pass def makefile(self, mode=None, bufsize=None): """ makefile([mode[, bufsize]]) -> file object Return a regular file object corresponding to the socket. The mode and bufsize arguments are as for the built-in open() function. """ return file(__file__) proto = property(None, None, None, """ the socket protocol """ ) recv = None recv_into = None recvfrom = None recvfrom_into = None send = None def sendall(self, data, flags=None): """ sendall(data[, flags]) Send a data string to the socket. For the optional flags argument, see the Unix manual. This calls send() repeatedly until all data is sent. If an error occurs, it's impossible to tell how much data has been sent. """ pass sendto = None def setblocking(self, flag): """ 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). """ pass def setsockopt(self, level, option, value): """ 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. """ pass def settimeout(self, timeout): """ 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). """ pass def shutdown(self, flag): """ 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). """ pass type = property(None, None, None, """ the socket type """ ) _ssl = None def create_connection(arg0, arg1): """ Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. A host of '' or port 0 tells the OS to use the default. """ pass errno = None class error(IOError): pass def fromfd(fd, family, type, proto=None): """ 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(). """ return SocketType() class gaierror(error): pass def getaddrinfo(host, port, family=None, socktype=None, proto=None, flags=None): """ getaddrinfo(host, port [, family, socktype, proto, flags]) -> list of (family, socktype, proto, canonname, sockaddr) Resolve host and port into addrinfo struct. """ pass def getdefaulttimeout(): """ getdefaulttimeout() -> timeout Returns the default timeout in seconds (float) 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. """ return None def gethostbyaddr(host): """ gethostbyaddr(host) -> (name, aliaslist, addresslist) Return the true host name, a list of aliases, and a list of IP addresses, for a host. The host argument is a string giving a host name or IP number. """ return (None, [], []) def gethostbyname(host): """ gethostbyname(host) -> address Return the IP address (a string of the form '255.255.255.255') for a host. """ return None def gethostbyname_ex(host): """ gethostbyname_ex(host) -> (name, aliaslist, addresslist) Return the true host name, a list of aliases, and a list of IP addresses, for a host. The host argument is a string giving a host name or IP number. """ return (None, [], []) def gethostname(): """ gethostname() -> string Return the current host name. """ return "" def getnameinfo(sockaddr, flags): """ getnameinfo(sockaddr, flags) --> (host, port) Get host and port for a sockaddr. """ return (None, None) def getprotobyname(name): """ getprotobyname(name) -> integer Return the protocol number for the named protocol. (Rarely used.) """ return 1 def getservbyname(servicename, protocolname=None): """ getservbyname(servicename[, protocolname]) -> integer Return a port number from a service name and protocol name. The optional protocol name, if given, should be 'tcp' or 'udp', otherwise any protocol will match. """ return 1 def getservbyport(port, protocolname=None): """ getservbyport(port[, protocolname]) -> string Return the service name from a port number and protocol name. The optional protocol name, if given, should be 'tcp' or 'udp', otherwise any protocol will match. """ return "" has_ipv6 = True class herror(error): pass def htonl(integer): """ htonl(integer) -> integer Convert a 32-bit integer from host to network byte order. """ return 1 def htons(integer): """ htons(integer) -> integer Convert a 16-bit integer from host to network byte order. """ return 1 def inet_aton(string): """ inet_aton(string) -> packed 32-bit IP representation Convert an IP address in string format (123.45.67.89) to the 32-bit packed binary format used in low-level network functions. """ return None def inet_ntoa(packed_ip): """ inet_ntoa(packed_ip) -> ip_address_string Convert an IP address from 32-bit packed binary format to string format """ return "" def inet_ntop(af, packed_ip): """ inet_ntop(af, packed_ip) -> string formatted IP address Convert a packed IP address of the given family to string format. """ return "" def inet_pton(af, ip): """ inet_pton(af, ip) -> packed IP address string Convert an IP address from string format to a packed string suitable for use with low-level network functions. """ return "" def m(self, flag): """ 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). """ pass def meth(name, self): pass def ntohl(integer): """ ntohl(integer) -> integer Convert a 32-bit integer from network to host byte order. """ return 1 def ntohs(integer): """ ntohs(integer) -> integer Convert a 16-bit integer from network to host byte order. """ return 1 os = None def p(flag): """ 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). """ pass class partial(object): """ partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords. """ args = None func = None keywords = None def setdefaulttimeout(timeout): """ setdefaulttimeout(timeout) Set the default timeout in seconds (float) 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. """ pass socket = _socketobject def socketpair(family=None, type=None, proto=None): """ socketpair([family[, type[, proto]]]) -> (socket object, socket object) Create a pair of socket objects from the sockets returned by the platform socketpair() function. The arguments are the same as for socket() except the default family is AF_UNIX if defined on the platform; otherwise, the default is AF_INET. """ return (SocketType(), SocketType()) def ssl(sock, keyfile, certfile): pass class sslerror(error): """ An error occurred in the SSL implementation. """ pass sys = None class timeout(error): pass warnings = None # BEGIN MANUAL OVERRIDES FROM static-pi-files/2.2/socketoverride.py class SocketType: """ socket([family[, type[, proto]]]) -> socket object Open a socket of the given type. The family argument specifies the address family; it defaults to AF_INET. The type argument specifies whether this is a stream (SOCK_STREAM, this is the default) or datagram (SOCK_DGRAM) socket. The protocol argument defaults to 0, specifying the default protocol. A socket represents one endpoint of a network connection. Methods: accept() -- accept a connection, returning new socket and client address bind() -- bind the socket to a local address close() -- close the socket connect() -- connect the socket to a remote address connect_ex() -- connect, return an error code instead of an exception dup() -- return a new socket object identical to the current one (*) fileno() -- return underlying file descriptor getpeername() -- return remote address (*) getsockname() -- return local address getsockopt() -- get socket options listen() -- start listening for incoming connections makefile() -- return a file object corresponding to the socket (*) recv() -- receive data recvfrom() -- receive data and sender's address send() -- send data, may not send all of it sendall() -- send all data sendto() -- send data to a given address setblocking() -- set or clear the blocking I/O flag setsockopt() -- set socket options shutdown() -- shut down traffic in one or both directions (*) not available on all platforms!) """ def 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). """ return (SocketType(), info) def bind(self, address): """ 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]]) """ pass def close(self): """ close() Close the socket. It cannot be used after this call. """ pass def connect(self, address): """ connect(address) Connect the socket to a remote address. For IP sockets, the address is a pair (host, port). """ pass def connect_ex(self, address): """ connect_ex(address) This is like connect(address), but returns an error code (the errno value) instead of raising an exception when an error occurs. """ return 1 def dup(self): """ dup() -> socket object Return a new socket object connected to the same system resource. """ return SocketType() def fileno(self): """ fileno() -> integer Return the integer file descriptor of the socket. """ return 1 def getpeername(self): """ getpeername() -> address info Return the address of the remote endpoint. For IP sockets, the address info is a pair (hostaddr, port). """ return ('', 1) def getsockname(self): """ getsockname() -> address info Return the address of the local endpoint. For IP sockets, the address info is a pair (hostaddr, port). """ return ('', 1) def getsockopt(self, level, option, buffersize = -1): """ 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. """ return object def listen(self, backlog): """ listen(backlog) Enable a server to accept connections. The backlog argument must be at least 1; it specifies the number of unaccepted connection that the system will allow before refusing new connections. """ pass def makefile(self, mode, buffersize = -1): """ makefile([mode[, buffersize]]) -> file object Return a regular file object corresponding to the socket. The mode and buffersize arguments are as for the built-in open() function. """ return open() def recv(self, buffersize, flags = 0): """ recv(buffersize[, flags]) -> data Receive up to buffersize bytes from the socket. For the optional flags argument, see the Unix manual. When no data is available, block until at least one byte is available or until the remote end is closed. When the remote end is closed and all data is read, return the empty string. """ return '' def recvfrom(self, buffersize, flags = 0): """ recvfrom(buffersize[, flags]) -> (data, address info) Like recv(buffersize, flags) but also return the sender's address info. """ return ('', info) def send(self, data, flags=0): """ send(data[, flags]) -> count Send a data string to the socket. For the optional flags argument, see the Unix manual. Return the number of bytes sent; this may be less than len(data) if the network is busy. """ return 1 def sendall(self, data, flags=0): """ sendall(data[, flags]) Send a data string to the socket. For the optional flags argument, see the Unix manual. This calls send() repeatedly until all data is sent. If an error occurs, it's impossible to tell how much data has been sent. """ pass def sendto(self, data, flags=0, address=('', 0)): """ sendto(data[, flags], address) Like send(data, flags) but allows specifying the destination address. For IP sockets, the address is a pair (hostaddr, port). """ return 1 def setblocking(self, flag): """ setblocking(flag) Set the socket to blocking (flag is true) or non-blocking (false). This uses the FIONBIO ioctl with the O_NDELAY flag. """ pass def setsockopt(self, level, option, value): """ 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. """ pass def shutdown(self, flag): """ shutdown(flag) Shut down the reading side of the socket (flag == 0), the writing side of the socket (flag == 1), or both ends (flag == 2). """ pass __builtins__ = {} __doc__ = None __file__ = '/Users/Shared/src/ide/build-files/static-pi-files/2.2/socketoverride.py' __name__ = 'socketoverride' __package__ = None def getfqdn(name): """ getfqdn(name) -> string 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 is returned. """ return '' # END MANUAL OVERRIDES