eventlet.greenio package¶
Submodules¶
eventlet.greenio.base module¶
- class eventlet.greenio.base.GreenSocket(family=AddressFamily.AF_INET, *args, **kwargs)¶
基类:
object
Green version of socket.socket class, that is intended to be 100% API-compatible.
It also recognizes the keyword parameter, 'set_nonblocking=True'. Pass False to indicate that socket is already in non-blocking mode to save syscalls.
- accept()¶
- connect(address)¶
- connect_ex(address)¶
- dup(*args, **kw)¶
- fd = None¶
- gettimeout()¶
- makeGreenFile(*args, **kw)¶
- makefile(*args, **kwargs)¶
- recv(bufsize, flags=0)¶
- recv_into(buffer, nbytes=0, flags=0)¶
- recvfrom(bufsize, flags=0)¶
- recvfrom_into(buffer, nbytes=0, flags=0)¶
- send(data, flags=0)¶
- sendall(data, flags=0)¶
- sendto(data, *args)¶
- setblocking(flag)¶
- settimeout(howlong)¶
- eventlet.greenio.base.set_nonblocking(fd)¶
Sets the descriptor to be nonblocking. Works on many file-like objects as well as sockets. Only sockets can be nonblocking on Windows, however.
- eventlet.greenio.base.shutdown_safe(sock)¶
Shuts down the socket. This is a convenience method for code that wants to gracefully handle regular sockets, SSL.Connection sockets from PyOpenSSL and ssl.SSLSocket objects from Python 2.7 interchangeably. Both types of ssl socket require a shutdown() before close, but they have different arity on their shutdown method.
Regular sockets don't need a shutdown before close, but it doesn't hurt.
- eventlet.greenio.base.socket_timeout¶
TimeoutError
的别名
eventlet.greenio.py3 module¶
- eventlet.greenio.py3.GreenPipe(name, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)¶
GreenPipe is a cooperative replacement for file class. It will cooperate on pipes. It will block on regular file. Differences from file class: - mode is r/w property. Should re r/o - encoding property not implemented - write/writelines will not raise TypeError exception when non-string data is written
it will write str(data) instead
Universal new lines are not supported and newlines property not implementeded
file argument can be descriptor, file name or file object.