Class: Socket
Methods
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.
listen (self, *args)
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.
makefile (self, mode='r', bufsize=-1)
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.
sendall (self, *args)
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.
setblocking (self, *args)
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).
Attributes
Value of
<property object at 0x00E6CE18>
Value of
<property object at 0x00E6CE68>
Value of
<property object at 0x00E6CE40>
recv
Value of recv
<member 'recv' of '_socketobject' objects>
recv_into
Value of recv_into
<member 'recv_into' of '_socketobject' objects>
recvfrom
Value of recvfrom
<member 'recvfrom' of '_socketobject' objects>
recvfrom_into
Value of recvfrom_into
<member 'recvfrom_into' of '_socketobject' objects>
send
Value of send
<member 'send' of '_socketobject' objects>
sendto
Value of sendto
<member 'sendto' of '_socketobject' objects>