@@ -95,132 +95,132 @@ any that have been added to the map during asynchronous service) is closed.
9595 should be added to the list of channels :cfunc: `select `\ ed or
9696 :cfunc: `poll `\ ed for read and write events.
9797
98- Thus, the set of channel events is larger than the basic socket events. The
99- full set of methods that can be overridden in your subclass follows:
98+ Thus, the set of channel events is larger than the basic socket events. The
99+ full set of methods that can be overridden in your subclass follows:
100100
101101
102- .. method :: dispatcher. handle_read()
102+ .. method :: handle_read()
103103
104- Called when the asynchronous loop detects that a :meth: `read ` call on the
105- channel's socket will succeed.
104+ Called when the asynchronous loop detects that a :meth: `read ` call on the
105+ channel's socket will succeed.
106106
107107
108- .. method :: dispatcher. handle_write()
108+ .. method :: handle_write()
109109
110- Called when the asynchronous loop detects that a writable socket can be
111- written. Often this method will implement the necessary buffering for
112- performance. For example::
110+ Called when the asynchronous loop detects that a writable socket can be
111+ written. Often this method will implement the necessary buffering for
112+ performance. For example::
113113
114- def handle_write(self):
115- sent = self.send(self.buffer)
116- self.buffer = self.buffer[sent:]
114+ def handle_write(self):
115+ sent = self.send(self.buffer)
116+ self.buffer = self.buffer[sent:]
117117
118118
119- .. method :: dispatcher. handle_expt()
119+ .. method :: handle_expt()
120120
121- Called when there is out of band (OOB) data for a socket connection. This
122- will almost never happen, as OOB is tenuously supported and rarely used.
121+ Called when there is out of band (OOB) data for a socket connection. This
122+ will almost never happen, as OOB is tenuously supported and rarely used.
123123
124124
125- .. method :: dispatcher. handle_connect()
125+ .. method :: handle_connect()
126126
127- Called when the active opener's socket actually makes a connection. Might
128- send a "welcome" banner, or initiate a protocol negotiation with the remote
129- endpoint, for example.
127+ Called when the active opener's socket actually makes a connection. Might
128+ send a "welcome" banner, or initiate a protocol negotiation with the
129+ remote endpoint, for example.
130130
131131
132- .. method :: dispatcher. handle_close()
132+ .. method :: handle_close()
133133
134- Called when the socket is closed.
134+ Called when the socket is closed.
135135
136136
137- .. method :: dispatcher. handle_error()
137+ .. method :: handle_error()
138138
139- Called when an exception is raised and not otherwise handled. The default
140- version prints a condensed traceback.
139+ Called when an exception is raised and not otherwise handled. The default
140+ version prints a condensed traceback.
141141
142142
143- .. method :: dispatcher. handle_accept()
143+ .. method :: handle_accept()
144144
145- Called on listening channels (passive openers) when a connection can be
146- established with a new remote endpoint that has issued a :meth: `connect `
147- call for the local endpoint.
145+ Called on listening channels (passive openers) when a connection can be
146+ established with a new remote endpoint that has issued a :meth: `connect `
147+ call for the local endpoint.
148148
149149
150- .. method :: dispatcher. readable()
150+ .. method :: readable()
151151
152- Called each time around the asynchronous loop to determine whether a
153- channel's socket should be added to the list on which read events can
154- occur. The default method simply returns ``True ``, indicating that by
155- default, all channels will be interested in read events.
152+ Called each time around the asynchronous loop to determine whether a
153+ channel's socket should be added to the list on which read events can
154+ occur. The default method simply returns ``True ``, indicating that by
155+ default, all channels will be interested in read events.
156156
157157
158- .. method :: dispatcher. writable()
158+ .. method :: writable()
159159
160- Called each time around the asynchronous loop to determine whether a
161- channel's socket should be added to the list on which write events can
162- occur. The default method simply returns ``True ``, indicating that by
163- default, all channels will be interested in write events.
160+ Called each time around the asynchronous loop to determine whether a
161+ channel's socket should be added to the list on which write events can
162+ occur. The default method simply returns ``True ``, indicating that by
163+ default, all channels will be interested in write events.
164164
165- In addition, each channel delegates or extends many of the socket methods.
166- Most of these are nearly identical to their socket partners.
167165
166+ In addition, each channel delegates or extends many of the socket methods.
167+ Most of these are nearly identical to their socket partners.
168168
169- .. method :: dispatcher.create_socket(family, type)
170169
171- This is identical to the creation of a normal socket, and will use the same
172- options for creation. Refer to the :mod: `socket ` documentation for
173- information on creating sockets.
170+ .. method :: create_socket(family, type)
174171
172+ This is identical to the creation of a normal socket, and will use the
173+ same options for creation. Refer to the :mod: `socket ` documentation for
174+ information on creating sockets.
175175
176- .. method :: dispatcher.connect(address)
177176
178- As with the normal socket object, *address * is a tuple with the first
179- element the host to connect to, and the second the port number.
177+ .. method :: connect(address)
180178
179+ As with the normal socket object, *address * is a tuple with the first
180+ element the host to connect to, and the second the port number.
181181
182- .. method :: dispatcher.send(data)
183182
184- Send * data * to the remote end-point of the socket.
183+ .. method :: send(data)
185184
185+ Send *data * to the remote end-point of the socket.
186186
187- .. method :: dispatcher.recv(buffer_size)
188187
189- Read at most *buffer_size * bytes from the socket's remote end-point.
190- An empty string implies that the channel has been closed from the other
191- end.
188+ .. method :: recv(buffer_size)
192189
190+ Read at most *buffer_size * bytes from the socket's remote end-point. An
191+ empty string implies that the channel has been closed from the other end.
193192
194- .. method :: dispatcher.listen(backlog)
195193
196- Listen for connections made to the socket. The *backlog * argument
197- specifies the maximum number of queued connections and should be at least
198- 1; the maximum value is system-dependent (usually 5).
194+ .. method :: listen(backlog)
199195
196+ Listen for connections made to the socket. The *backlog * argument
197+ specifies the maximum number of queued connections and should be at least
198+ 1; the maximum value is system-dependent (usually 5).
200199
201- .. method :: dispatcher.bind(address)
202200
203- Bind the socket to *address *. The socket must not already be bound. (The
204- format of *address * depends on the address family --- see above.) To mark
205- the socket as re-usable (setting the :const: `SO_REUSEADDR ` option), call
206- the :class: `dispatcher ` object's :meth: `set_reuse_addr ` method.
201+ .. method :: bind(address)
207202
203+ Bind the socket to *address *. The socket must not already be bound. (The
204+ format of *address * depends on the address family --- see above.) To mark
205+ the socket as re-usable (setting the :const: `SO_REUSEADDR ` option), call
206+ the :class: `dispatcher ` object's :meth: `set_reuse_addr ` method.
208207
209- .. method :: dispatcher.accept()
210208
211- Accept a connection. The socket must be bound to an address and listening
212- for connections. The return value is a pair ``(conn, address) `` where
213- *conn * is a *new * socket object usable to send and receive data on the
214- connection, and *address * is the address bound to the socket on the other
215- end of the connection.
209+ .. method :: accept()
216210
211+ Accept a connection. The socket must be bound to an address and listening
212+ for connections. The return value is a pair ``(conn, address) `` where
213+ *conn * is a *new * socket object usable to send and receive data on the
214+ connection, and *address * is the address bound to the socket on the other
215+ end of the connection.
217216
218- .. method :: dispatcher.close()
219217
220- Close the socket. All future operations on the socket object will fail.
221- The remote end-point will receive no more data (after queued data is
222- flushed). Sockets are automatically closed when they are
223- garbage-collected.
218+ .. method :: close()
219+
220+ Close the socket. All future operations on the socket object will fail.
221+ The remote end-point will receive no more data (after queued data is
222+ flushed). Sockets are automatically closed when they are
223+ garbage-collected.
224224
225225
226226.. _asyncore-example :
0 commit comments