Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f1c472

Browse files
committed
Use {methoddesc} as appropriate.
1 parent 5dabeed commit 3f1c472

2 files changed

Lines changed: 74 additions & 76 deletions

File tree

Doc/lib/libsocket.tex

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -189,60 +189,59 @@ \subsection{Socket Objects}
189189
\method{makefile()} these correspond to \UNIX{} system calls
190190
applicable to sockets.
191191
192-
\setindexsubitem{(socket method)}
193-
\begin{funcdesc}{accept}{}
192+
\begin{methoddesc}[socket]{accept}{}
194193
Accept a connection.
195194
The socket must be bound to an address and listening for connections.
196195
The return value is a pair \code{(\var{conn}, \var{address})}
197196
where \var{conn} is a \emph{new} socket object usable to send and
198197
receive data on the connection, and \var{address} is the address bound
199198
to 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}
203202
Bind 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}{}
208207
Close the socket. All future operations on the socket object will fail.
209208
The remote end will receive no more data (after queued data is flushed).
210209
Sockets 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}
214213
Connect to a remote socket at \var{address}.
215214
(The format of \var{address} depends on the address family --- see
216215
above.)
217-
\end{funcdesc}
216+
\end{methoddesc}
218217
219-
\begin{funcdesc}{connect_ex}{address}
218+
\begin{methoddesc}[socket]{connect_ex}{address}
220219
Like \code{connect(\var{address})}, but return an error indicator
221220
instead of raising an exception. The error indicator is 0 if the
222221
operation 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}{}
227226
Return the socket's file descriptor (a small integer). This is useful
228227
with \function{select.select()}.
229-
\end{funcdesc}
228+
\end{methoddesc}
230229
231-
\begin{funcdesc}{getpeername}{}
230+
\begin{methoddesc}[socket]{getpeername}{}
232231
Return the remote address to which the socket is connected. This is
233232
useful 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 ---
235234
see 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}{}
239238
Return the socket's own address. This is useful to find out the port
240239
number of an IP socket, for instance.
241240
(The format of the address returned depends on the address family ---
242241
see 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}}
246245
Return 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}
252251
this buffer is returned as a string. It is up to the caller to decode
253252
the 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}
258257
Listen for connections made to the socket. The \var{backlog} argument
259258
specifies the maximum number of queued connections and should be at
260259
least 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}}}
264263
Return a \dfn{file object} associated with the socket. (File objects
265264
were described earlier in \ref{bltin-file-objects}, ``File Objects.'')
266265
The file object references a \cfunction{dup()}ped version of the
267266
socket file descriptor, so the file object and socket object may be
268267
closed or garbage-collected independently. The optional \var{mode}
269268
and \var{bufsize} arguments are interpreted the same way as by the
270269
built-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}}
274273
Receive data from the socket. The return value is a string representing
275274
the data received. The maximum amount of data to be received
276275
at 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}}
282281
Receive data from the socket. The return value is a pair
283282
\code{(\var{string}, \var{address})} where \var{string} is a string
284283
representing the data received and \var{address} is the address of the
285284
socket sending the data. The optional \var{flags} argument has the
286285
same 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}}
291290
Send data to the socket. The socket must be connected to a remote
292291
socket. 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}
297296
Send data to the socket. The socket should not be connected to a
298297
remote socket, since the destination socket is specified by
299298
\var{address}. The optional \var{flags} argument has the same
300299
meaning 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}
305304
Set blocking or non-blocking mode of the socket: if \var{flag} is 0,
306305
the socket is set to non-blocking, else to blocking mode. Initially
307306
all 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
309308
immediately dispose of the data, a \exception{error} exception is
310309
raised; 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}
314313
Set the value of the given socket option (see the \UNIX{} man page
315314
\manpage{setsockopt}{2}). The needed symbolic constants are defined in
316315
the \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
321320
as strings).
322-
\end{funcdesc}
321+
\end{methoddesc}
323322
324-
\begin{funcdesc}{shutdown}{how}
323+
\begin{methoddesc}[socket]{shutdown}{how}
325324
Shut 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},
327326
further sends are disallowed. If \var{how} is \code{2}, further sends
328327
and receives are disallowed.
329-
\end{funcdesc}
328+
\end{methoddesc}
330329
331330
Note that there are no methods \method{read()} or \method{write()};
332331
use \method{recv()} and \method{send()} without \var{flags} argument

Doc/libsocket.tex

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -189,60 +189,59 @@ \subsection{Socket Objects}
189189
\method{makefile()} these correspond to \UNIX{} system calls
190190
applicable to sockets.
191191
192-
\setindexsubitem{(socket method)}
193-
\begin{funcdesc}{accept}{}
192+
\begin{methoddesc}[socket]{accept}{}
194193
Accept a connection.
195194
The socket must be bound to an address and listening for connections.
196195
The return value is a pair \code{(\var{conn}, \var{address})}
197196
where \var{conn} is a \emph{new} socket object usable to send and
198197
receive data on the connection, and \var{address} is the address bound
199198
to 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}
203202
Bind 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}{}
208207
Close the socket. All future operations on the socket object will fail.
209208
The remote end will receive no more data (after queued data is flushed).
210209
Sockets 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}
214213
Connect to a remote socket at \var{address}.
215214
(The format of \var{address} depends on the address family --- see
216215
above.)
217-
\end{funcdesc}
216+
\end{methoddesc}
218217
219-
\begin{funcdesc}{connect_ex}{address}
218+
\begin{methoddesc}[socket]{connect_ex}{address}
220219
Like \code{connect(\var{address})}, but return an error indicator
221220
instead of raising an exception. The error indicator is 0 if the
222221
operation 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}{}
227226
Return the socket's file descriptor (a small integer). This is useful
228227
with \function{select.select()}.
229-
\end{funcdesc}
228+
\end{methoddesc}
230229
231-
\begin{funcdesc}{getpeername}{}
230+
\begin{methoddesc}[socket]{getpeername}{}
232231
Return the remote address to which the socket is connected. This is
233232
useful 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 ---
235234
see 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}{}
239238
Return the socket's own address. This is useful to find out the port
240239
number of an IP socket, for instance.
241240
(The format of the address returned depends on the address family ---
242241
see 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}}
246245
Return 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}
252251
this buffer is returned as a string. It is up to the caller to decode
253252
the 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}
258257
Listen for connections made to the socket. The \var{backlog} argument
259258
specifies the maximum number of queued connections and should be at
260259
least 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}}}
264263
Return a \dfn{file object} associated with the socket. (File objects
265264
were described earlier in \ref{bltin-file-objects}, ``File Objects.'')
266265
The file object references a \cfunction{dup()}ped version of the
267266
socket file descriptor, so the file object and socket object may be
268267
closed or garbage-collected independently. The optional \var{mode}
269268
and \var{bufsize} arguments are interpreted the same way as by the
270269
built-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}}
274273
Receive data from the socket. The return value is a string representing
275274
the data received. The maximum amount of data to be received
276275
at 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}}
282281
Receive data from the socket. The return value is a pair
283282
\code{(\var{string}, \var{address})} where \var{string} is a string
284283
representing the data received and \var{address} is the address of the
285284
socket sending the data. The optional \var{flags} argument has the
286285
same 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}}
291290
Send data to the socket. The socket must be connected to a remote
292291
socket. 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}
297296
Send data to the socket. The socket should not be connected to a
298297
remote socket, since the destination socket is specified by
299298
\var{address}. The optional \var{flags} argument has the same
300299
meaning 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}
305304
Set blocking or non-blocking mode of the socket: if \var{flag} is 0,
306305
the socket is set to non-blocking, else to blocking mode. Initially
307306
all 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
309308
immediately dispose of the data, a \exception{error} exception is
310309
raised; 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}
314313
Set the value of the given socket option (see the \UNIX{} man page
315314
\manpage{setsockopt}{2}). The needed symbolic constants are defined in
316315
the \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
321320
as strings).
322-
\end{funcdesc}
321+
\end{methoddesc}
323322
324-
\begin{funcdesc}{shutdown}{how}
323+
\begin{methoddesc}[socket]{shutdown}{how}
325324
Shut 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},
327326
further sends are disallowed. If \var{how} is \code{2}, further sends
328327
and receives are disallowed.
329-
\end{funcdesc}
328+
\end{methoddesc}
330329
331330
Note that there are no methods \method{read()} or \method{write()};
332331
use \method{recv()} and \method{send()} without \var{flags} argument

0 commit comments

Comments
 (0)