diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-04-25 01:29:10 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-04-25 01:29:10 (GMT) |
commit | c7b05920d6536f7edba098d5018a470d35f2e864 (patch) | |
tree | ce0f68baf5c7794f235604c64cde02c12aeed3de /Doc/library/asyncore.rst | |
parent | 1c596d5604e4fc79944281ddc5baa666f6e27e85 (diff) | |
download | cpython-c7b05920d6536f7edba098d5018a470d35f2e864.zip cpython-c7b05920d6536f7edba098d5018a470d35f2e864.tar.gz cpython-c7b05920d6536f7edba098d5018a470d35f2e864.tar.bz2 |
reformat some documentation of classes so methods and attributes are under the class directive
Diffstat (limited to 'Doc/library/asyncore.rst')
-rw-r--r-- | Doc/library/asyncore.rst | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/Doc/library/asyncore.rst b/Doc/library/asyncore.rst index 5f43c07..da94a9b 100644 --- a/Doc/library/asyncore.rst +++ b/Doc/library/asyncore.rst @@ -95,132 +95,132 @@ any that have been added to the map during asynchronous service) is closed. should be added to the list of channels :cfunc:`select`\ ed or :cfunc:`poll`\ ed for read and write events. -Thus, the set of channel events is larger than the basic socket events. The -full set of methods that can be overridden in your subclass follows: + Thus, the set of channel events is larger than the basic socket events. The + full set of methods that can be overridden in your subclass follows: -.. method:: dispatcher.handle_read() + .. method:: handle_read() - Called when the asynchronous loop detects that a :meth:`read` call on the - channel's socket will succeed. + Called when the asynchronous loop detects that a :meth:`read` call on the + channel's socket will succeed. -.. method:: dispatcher.handle_write() + .. method:: handle_write() - Called when the asynchronous loop detects that a writable socket can be - written. Often this method will implement the necessary buffering for - performance. For example:: + Called when the asynchronous loop detects that a writable socket can be + written. Often this method will implement the necessary buffering for + performance. For example:: - def handle_write(self): - sent = self.send(self.buffer) - self.buffer = self.buffer[sent:] + def handle_write(self): + sent = self.send(self.buffer) + self.buffer = self.buffer[sent:] -.. method:: dispatcher.handle_expt() + .. method:: handle_expt() - Called when there is out of band (OOB) data for a socket connection. This - will almost never happen, as OOB is tenuously supported and rarely used. + Called when there is out of band (OOB) data for a socket connection. This + will almost never happen, as OOB is tenuously supported and rarely used. -.. method:: dispatcher.handle_connect() + .. method:: handle_connect() - Called when the active opener's socket actually makes a connection. Might - send a "welcome" banner, or initiate a protocol negotiation with the remote - endpoint, for example. + Called when the active opener's socket actually makes a connection. Might + send a "welcome" banner, or initiate a protocol negotiation with the + remote endpoint, for example. -.. method:: dispatcher.handle_close() + .. method:: handle_close() - Called when the socket is closed. + Called when the socket is closed. -.. method:: dispatcher.handle_error() + .. method:: handle_error() - Called when an exception is raised and not otherwise handled. The default - version prints a condensed traceback. + Called when an exception is raised and not otherwise handled. The default + version prints a condensed traceback. -.. method:: dispatcher.handle_accept() + .. method:: handle_accept() - Called on listening channels (passive openers) when a connection can be - established with a new remote endpoint that has issued a :meth:`connect` - call for the local endpoint. + Called on listening channels (passive openers) when a connection can be + established with a new remote endpoint that has issued a :meth:`connect` + call for the local endpoint. -.. method:: dispatcher.readable() + .. method:: readable() - Called each time around the asynchronous loop to determine whether a - channel's socket should be added to the list on which read events can - occur. The default method simply returns ``True``, indicating that by - default, all channels will be interested in read events. + Called each time around the asynchronous loop to determine whether a + channel's socket should be added to the list on which read events can + occur. The default method simply returns ``True``, indicating that by + default, all channels will be interested in read events. -.. method:: dispatcher.writable() + .. method:: writable() - Called each time around the asynchronous loop to determine whether a - channel's socket should be added to the list on which write events can - occur. The default method simply returns ``True``, indicating that by - default, all channels will be interested in write events. + Called each time around the asynchronous loop to determine whether a + channel's socket should be added to the list on which write events can + occur. The default method simply returns ``True``, indicating that by + default, all channels will be interested in write events. -In addition, each channel delegates or extends many of the socket methods. -Most of these are nearly identical to their socket partners. + In addition, each channel delegates or extends many of the socket methods. + Most of these are nearly identical to their socket partners. -.. method:: dispatcher.create_socket(family, type) - This is identical to the creation of a normal socket, and will use the same - options for creation. Refer to the :mod:`socket` documentation for - information on creating sockets. + .. method:: create_socket(family, type) + This is identical to the creation of a normal socket, and will use the + same options for creation. Refer to the :mod:`socket` documentation for + information on creating sockets. -.. method:: dispatcher.connect(address) - As with the normal socket object, *address* is a tuple with the first - element the host to connect to, and the second the port number. + .. method:: connect(address) + As with the normal socket object, *address* is a tuple with the first + element the host to connect to, and the second the port number. -.. method:: dispatcher.send(data) - Send *data* to the remote end-point of the socket. + .. method:: send(data) + Send *data* to the remote end-point of the socket. -.. method:: dispatcher.recv(buffer_size) - Read at most *buffer_size* bytes from the socket's remote end-point. - An empty string implies that the channel has been closed from the other - end. + .. method:: recv(buffer_size) + Read at most *buffer_size* bytes from the socket's remote end-point. An + empty string implies that the channel has been closed from the other end. -.. method:: dispatcher.listen(backlog) - Listen for connections made to the socket. The *backlog* argument - specifies the maximum number of queued connections and should be at least - 1; the maximum value is system-dependent (usually 5). + .. method:: listen(backlog) + Listen for connections made to the socket. The *backlog* argument + specifies the maximum number of queued connections and should be at least + 1; the maximum value is system-dependent (usually 5). -.. method:: dispatcher.bind(address) - Bind the socket to *address*. The socket must not already be bound. (The - format of *address* depends on the address family --- see above.) To mark - the socket as re-usable (setting the :const:`SO_REUSEADDR` option), call - the :class:`dispatcher` object's :meth:`set_reuse_addr` method. + .. method:: bind(address) + Bind the socket to *address*. The socket must not already be bound. (The + format of *address* depends on the address family --- see above.) To mark + the socket as re-usable (setting the :const:`SO_REUSEADDR` option), call + the :class:`dispatcher` object's :meth:`set_reuse_addr` method. -.. method:: dispatcher.accept() - Accept a connection. The socket must be bound to an address and listening - for connections. The return value is a pair ``(conn, address)`` where - *conn* is a *new* socket object usable to send and receive data on the - connection, and *address* is the address bound to the socket on the other - end of the connection. + .. method:: accept() + Accept a connection. The socket must be bound to an address and listening + for connections. The return value is a pair ``(conn, address)`` where + *conn* is a *new* socket object usable to send and receive data on the + connection, and *address* is the address bound to the socket on the other + end of the connection. -.. method:: dispatcher.close() - Close the socket. All future operations on the socket object will fail. - The remote end-point will receive no more data (after queued data is - flushed). Sockets are automatically closed when they are - garbage-collected. + .. method:: close() + + Close the socket. All future operations on the socket object will fail. + The remote end-point will receive no more data (after queued data is + flushed). Sockets are automatically closed when they are + garbage-collected. .. _asyncore-example: |