module documentation
(source)

Utility functions for dealing with POSIX file descriptors.

Variable fcntl Undocumented
Function setNonBlocking Set the file description of the given file descriptor to non-blocking.
Function setBlocking Set the file description of the given file descriptor to blocking.
Function readFromFD Read from file descriptor, calling callback with resulting data.
Function writeToFD Write data to file descriptor.
Function _setCloseOnExec Make a file descriptor close-on-exec.
Function _unsetCloseOnExec Make a file descriptor close-on-exec.
fcntl = (source)

Undocumented

def setNonBlocking(fd): (source)

Set the file description of the given file descriptor to non-blocking.

def setBlocking(fd): (source)

Set the file description of the given file descriptor to blocking.

def _setCloseOnExec(fd): (source)

Make a file descriptor close-on-exec.

def _unsetCloseOnExec(fd): (source)

Make a file descriptor close-on-exec.

def readFromFD(fd, callback): (source)

Read from file descriptor, calling callback with resulting data.

If successful, call 'callback' with a single argument: the resulting data.

Returns same thing FileDescriptor.doRead would: CONNECTION_LOST, CONNECTION_DONE, or None.

Parametersfdnon-blocking file descriptor to be read from. (type: int)
callbacka callable which accepts a single argument. If data is read from the file descriptor it will be called with this data. Handling exceptions from calling the callback is up to the caller.

Note that if the descriptor is still connected but no data is read, None will be returned but callback will not be called.

ReturnsCONNECTION_LOST on error, CONNECTION_DONE when fd is closed, otherwise None.
def writeToFD(fd, data): (source)

Write data to file descriptor.

Returns same thing FileDescriptor.writeSomeData would.

Parametersfdnon-blocking file descriptor to be written to. (type: int)
databytes to write to fd. (type: str or buffer)
Returnsnumber of bytes written, or CONNECTION_LOST.
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.