@@ -189,60 +189,59 @@ \subsection{Socket Objects}
189189\method {makefile()} these correspond to \UNIX {} system calls
190190applicable to sockets.
191191
192- \setindexsubitem {(socket method)}
193- \begin {funcdesc }{accept}{}
192+ \begin {methoddesc }[socket]{accept}{}
194193Accept a connection.
195194The socket must be bound to an address and listening for connections.
196195The return value is a pair \code {(\var {conn}, \var {address})}
197196where \var {conn} is a \emph {new } socket object usable to send and
198197receive data on the connection, and \var {address} is the address bound
199198to the socket on the other end of the connection.
200- \end {funcdesc }
199+ \end {methoddesc }
201200
202- \begin {funcdesc } {bind}{address}
201+ \begin {methoddesc }[socket] {bind}{address}
203202Bind the socket to \var {address}. The socket must not already be bound.
204203(The format of \var {address} depends on the address family --- see above.)
205- \end {funcdesc }
204+ \end {methoddesc }
206205
207- \begin {funcdesc } {close}{}
206+ \begin {methoddesc }[socket] {close}{}
208207Close the socket. All future operations on the socket object will fail.
209208The remote end will receive no more data (after queued data is flushed).
210209Sockets are automatically closed when they are garbage-collected.
211- \end {funcdesc }
210+ \end {methoddesc }
212211
213- \begin {funcdesc } {connect}{address}
212+ \begin {methoddesc }[socket] {connect}{address}
214213Connect to a remote socket at \var {address}.
215214(The format of \var {address} depends on the address family --- see
216215above.)
217- \end {funcdesc }
216+ \end {methoddesc }
218217
219- \begin {funcdesc } {connect_ex}{address}
218+ \begin {methoddesc }[socket] {connect_ex}{address}
220219Like \code {connect(\var {address})}, but return an error indicator
221220instead of raising an exception. The error indicator is 0 if the
222221operation succeeded, otherwise the value of the \cdata {errno}
223- variable. This is useful e.g. for asynchronous connects.
224- \end {funcdesc }
222+ variable. This is useful, e.g., for asynchronous connects.
223+ \end {methoddesc }
225224
226- \begin {funcdesc } {fileno}{}
225+ \begin {methoddesc }[socket] {fileno}{}
227226Return the socket's file descriptor (a small integer). This is useful
228227with \function {select.select()}.
229- \end {funcdesc }
228+ \end {methoddesc }
230229
231- \begin {funcdesc } {getpeername}{}
230+ \begin {methoddesc }[socket] {getpeername}{}
232231Return the remote address to which the socket is connected. This is
233232useful to find out the port number of a remote IP socket, for instance.
234233(The format of the address returned depends on the address family ---
235234see above.) On some systems this function is not supported.
236- \end {funcdesc }
235+ \end {methoddesc }
237236
238- \begin {funcdesc } {getsockname}{}
237+ \begin {methoddesc }[socket] {getsockname}{}
239238Return the socket's own address. This is useful to find out the port
240239number of an IP socket, for instance.
241240(The format of the address returned depends on the address family ---
242241see above.)
243- \end {funcdesc }
242+ \end {methoddesc }
244243
245- \begin {funcdesc } {getsockopt}{level, optname\optional {, buflen}}
244+ \begin {methoddesc }[socket] {getsockopt}{level, optname\optional {, buflen}}
246245Return the value of the given socket option (see the \UNIX {} man page
247246\manpage {getsockopt}{2}). The needed symbolic constants
248247(\constant {SO_*} etc.) are defined in this module. If \var {buflen}
@@ -252,65 +251,65 @@ \subsection{Socket Objects}
252251this buffer is returned as a string. It is up to the caller to decode
253252the contents of the buffer (see the optional built-in module
254253\module {struct} for a way to decode C structures encoded as strings).
255- \end {funcdesc }
254+ \end {methoddesc }
256255
257- \begin {funcdesc } {listen}{backlog}
256+ \begin {methoddesc }[socket] {listen}{backlog}
258257Listen for connections made to the socket. The \var {backlog} argument
259258specifies the maximum number of queued connections and should be at
260259least 1; the maximum value is system-dependent (usually 5).
261- \end {funcdesc }
260+ \end {methoddesc }
262261
263- \begin {funcdesc } {makefile}{\optional {mode\optional {, bufsize}}}
262+ \begin {methoddesc }[socket] {makefile}{\optional {mode\optional {, bufsize}}}
264263Return a \dfn {file object} associated with the socket. (File objects
265264were described earlier in \ref {bltin-file-objects }, `` File Objects.'' )
266265The file object references a \cfunction {dup()}ped version of the
267266socket file descriptor, so the file object and socket object may be
268267closed or garbage-collected independently. The optional \var {mode}
269268and \var {bufsize} arguments are interpreted the same way as by the
270269built-in \function {open()} function.
271- \end {funcdesc }
270+ \end {methoddesc }
272271
273- \begin {funcdesc } {recv}{bufsize\optional {, flags}}
272+ \begin {methoddesc }[socket] {recv}{bufsize\optional {, flags}}
274273Receive data from the socket. The return value is a string representing
275274the data received. The maximum amount of data to be received
276275at once is specified by \var {bufsize}. See the \UNIX {} manual page
277276\manpage {recv}{2} for the meaning of the optional argument
278277\var {flags}; it defaults to zero.
279- \end {funcdesc }
278+ \end {methoddesc }
280279
281- \begin {funcdesc } {recvfrom}{bufsize\optional {, flags}}
280+ \begin {methoddesc }[socket] {recvfrom}{bufsize\optional {, flags}}
282281Receive data from the socket. The return value is a pair
283282\code {(\var {string}, \var {address})} where \var {string} is a string
284283representing the data received and \var {address} is the address of the
285284socket sending the data. The optional \var {flags} argument has the
286285same meaning as for \method {recv()} above.
287286(The format of \var {address} depends on the address family --- see above.)
288- \end {funcdesc }
287+ \end {methoddesc }
289288
290- \begin {funcdesc } {send}{string\optional {, flags}}
289+ \begin {methoddesc }[socket] {send}{string\optional {, flags}}
291290Send data to the socket. The socket must be connected to a remote
292291socket. The optional \var {flags} argument has the same meaning as for
293292\method {recv()} above. Returns the number of bytes sent.
294- \end {funcdesc }
293+ \end {methoddesc }
295294
296- \begin {funcdesc } {sendto}{string\optional {, flags}, address}
295+ \begin {methoddesc }[socket] {sendto}{string\optional {, flags}, address}
297296Send data to the socket. The socket should not be connected to a
298297remote socket, since the destination socket is specified by
299298\var {address}. The optional \var {flags} argument has the same
300299meaning as for \method {recv()} above. Return the number of bytes sent.
301300(The format of \var {address} depends on the address family --- see above.)
302- \end {funcdesc }
301+ \end {methoddesc }
303302
304- \begin {funcdesc } {setblocking}{flag}
303+ \begin {methoddesc }[socket] {setblocking}{flag}
305304Set blocking or non-blocking mode of the socket: if \var {flag} is 0,
306305the socket is set to non-blocking, else to blocking mode. Initially
307306all sockets are in blocking mode. In non-blocking mode, if a
308307\method {recv()} call doesn't find any data, or if a \code {send} call can't
309308immediately dispose of the data, a \exception {error} exception is
310309raised; in blocking mode, the calls block until they can proceed.
311- \end {funcdesc }
310+ \end {methoddesc }
312311
313- \begin {funcdesc } {setsockopt}{level, optname, value}
312+ \begin {methoddesc }[socket] {setsockopt}{level, optname, value}
314313Set the value of the given socket option (see the \UNIX {} man page
315314\manpage {setsockopt}{2}). The needed symbolic constants are defined in
316315the \module {socket} module (\code {SO_*} etc.). The value can be an
@@ -319,14 +318,14 @@ \subsection{Socket Objects}
319318(see the optional built-in module
320319\module {struct}\refbimodindex {struct} for a way to encode C structures
321320as strings).
322- \end {funcdesc }
321+ \end {methoddesc }
323322
324- \begin {funcdesc } {shutdown}{how}
323+ \begin {methoddesc }[socket] {shutdown}{how}
325324Shut down one or both halves of the connection. If \var {how} is
326325\code {0}, further receives are disallowed. If \var {how} is \code {1},
327326further sends are disallowed. If \var {how} is \code {2}, further sends
328327and receives are disallowed.
329- \end {funcdesc }
328+ \end {methoddesc }
330329
331330Note that there are no methods \method {read()} or \method {write()};
332331use \method {recv()} and \method {send()} without \var {flags} argument
0 commit comments