This module provides cooperative versions of os.read() and os.write(). On Posix platforms this uses non-blocking IO, on Windows a threadpool is used.
Read up to n bytes from file descriptor fd. Return a string containing the bytes read. If end-of-file is reached, an empty string is returned.
Write bytes from buffer buf to file descriptor fd. Return the number of bytes written.
Read up to n bytes from file descriptor fd. Return a string containing the bytes read. If end-of-file is reached, an empty string is returned.
The descriptor must be in non-blocking mode.
Write bytes from buffer buf to file descriptor fd. Return the number of bytes written.
The file descriptor must be in non-blocking mode.