From 5a485461a1157fef1bb3ce8426bfd1ad57b5ca52 Mon Sep 17 00:00:00 2001
From: Hans Bolinder
Date: Fri, 6 May 2011 16:01:56 +0200
Subject: Use Erlang specs and types for documentation
---
lib/kernel/doc/src/gen_tcp.xml | 163 +++++++++++++++++------------------------
1 file changed, 69 insertions(+), 94 deletions(-)
(limited to 'lib/kernel/doc/src/gen_tcp.xml')
diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml
index aa171c77c2..f1d42d9faa 100644
--- a/lib/kernel/doc/src/gen_tcp.xml
+++ b/lib/kernel/doc/src/gen_tcp.xml
@@ -4,7 +4,7 @@
- The returned socket ListenSocket can only be used in
+
The returned socket ListenSocket can only be used in
calls to accept/1,2.
The default values for options given to listen can
@@ -225,27 +227,23 @@ socket()
- accept(ListenSocket) -> {ok, Socket} | {error, Reason}
- accept(ListenSocket, Timeout) -> {ok, Socket} | {error, Reason}
+
+
Accept an incoming connection request on a listen socket
-
- ListenSocket -- see listen/2
- Timeout = int() | infinity
- Socket = socket()
- Reason = closed | timeout | posix()
-
+ Returned by listen/2.
+
Accepts an incoming connection request on a listen socket.
- Socket must be a socket returned from listen/2.
- Timeout specifies a timeout value in ms, defaults to
+ Socket must be a socket returned from listen/2.
+ Timeout specifies a timeout value in ms, defaults to
infinity.
- Returns {ok, Socket} if a connection is established,
- or {error, closed} if ListenSocket is closed,
+
Returns {ok, Socket} if a connection is established,
+ or {error, closed} if ListenSocket is closed,
or {error, timeout} if no connection is established
within the specified time. May also return a POSIX error
value if something else goes wrong, see inet(3) for possible
error values.
- Packets can be sent to the returned socket Socket
+
Packets can be sent to the returned socket Socket
using send/2. Packets sent from the peer are delivered
as messages:
@@ -264,13 +262,8 @@ socket()
- send(Socket, Packet) -> ok | {error, Reason}
+
Send a packet
-
- Socket = socket()
- Packet = [char()] | binary()
- Reason = posix()
-
Sends a packet on a socket.
There is no send call with timeout option, you use the
@@ -279,70 +272,52 @@ socket()
- recv(Socket, Length) -> {ok, Packet} | {error, Reason}
- recv(Socket, Length, Timeout) -> {ok, Packet} | {error, Reason}
+
+
Receive a packet from a passive socket
-
- Socket = socket()
- Length = int()
- Packet = [char()] | binary() | HttpPacket
- Timeout = int() | infinity
- Reason = closed | posix()
- HttpPacket = see the description of HttpPacket in erlang:decode_packet/3
-
+ See the description of
+ HttpPacket in
+ erlang:decode_packet/3.
+
This function receives a packet from a socket in passive
mode. A closed socket is indicated by a return value
{error, closed}.
- The Length argument is only meaningful when
+
The Length argument is only meaningful when
the socket is in raw mode and denotes the number of
- bytes to read. If Length = 0, all available bytes are
- returned. If Length > 0, exactly Length
+ bytes to read. If Length = 0, all available bytes are
+ returned. If Length > 0, exactly Length
bytes are returned, or an error; possibly discarding less
- than Length bytes of data when the socket gets closed
+ than Length bytes of data when the socket gets closed
from the other side.
- The optional Timeout parameter specifies a timeout in
+
The optional Timeout parameter specifies a timeout in
milliseconds. The default value is infinity.
- controlling_process(Socket, Pid) -> ok | {error, Reason}
+
Change controlling process of a socket
-
- Socket = socket()
- Pid = pid()
- Reason = closed | not_owner | posix()
-
- Assigns a new controlling process Pid to
- Socket. The controlling process is the process which
+
Assigns a new controlling process Pid to
+ Socket. The controlling process is the process which
receives messages from the socket. If called by any other
process than the current controlling process,
{error, eperm} is returned.
- close(Socket) -> ok | {error, Reason}
+
Close a TCP socket
-
- Socket = socket()
- Reason = posix()
-
Closes a TCP socket.
- shutdown(Socket, How) -> ok | {error, Reason}
+
Immediately close a socket
-
- Socket = socket()
- How = read | write | read_write
- Reason = posix()
-
Immediately close a socket in one or two directions.
- How == write means closing the socket for writing,
+
How == write means closing the socket for writing,
reading from it is still possible.
To be able to handle that the peer has done a shutdown on
the write side, the {exit_on_close, false} option
--
cgit v1.2.3