socket.socket

socket.socket

alias of _socketobject

Methods

__format__ default object formatter
__init__([family, type, proto, _sock])
__new__((S, ...)
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__sizeof__(() -> int) size of object in memory, in bytes
__subclasshook__ Abstract classes can override this to customize issubclass().
accept() -> (socket object, address info) Wait for an incoming connection.
bind(address) Bind the socket to a local address.
close() Close the socket.
connect(address) Connect the socket to a remote 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.
dup(() -> socket object) Return a new socket object connected to the same system resource.
fileno(() -> integer) Return the integer file descriptor of the socket.
getpeername(() -> address info) Return the address of the remote endpoint.
getsockname(() -> address info) Return the address of the local endpoint.
getsockopt((level, option[, ...) Get a socket option.
gettimeout(() -> timeout) Returns the timeout in seconds (float) associated with socket operations.
listen(backlog) Enable a server to accept connections.
makefile(([mode[, bufsize]]) -> file object) Return a regular file object corresponding to the socket.
sendall(data[, flags]) Send a data string to the socket.
setblocking(flag) Set the socket to blocking (flag is true) or non-blocking (false).
setsockopt(level, option, value) Set a socket option.
settimeout(timeout) Set a timeout on socket operations.
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).

Attributes

family the socket family
proto the socket protocol
recv
recv_into
recvfrom
recvfrom_into
send
sendto
type the socket type