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_udp.xml | 101 ++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 57 deletions(-) (limited to 'lib/kernel/doc/src/gen_udp.xml') diff --git a/lib/kernel/doc/src/gen_udp.xml b/lib/kernel/doc/src/gen_udp.xml index 71f2e9bd83..c0e783f508 100644 --- a/lib/kernel/doc/src/gen_udp.xml +++ b/lib/kernel/doc/src/gen_udp.xml @@ -4,7 +4,7 @@
- 19972009 + 19972011 Ericsson AB. All Rights Reserved. @@ -34,32 +34,43 @@ with sockets using the UDP protocol.

-
- DATA TYPES - -ip_address() - see inet(3) - -posix() - see inet(3) + + + + + + + +

Represents an address of a TCP socket. + It is a tuple as explained in + inet(3).

+
+
+ + + + + + +

See + inet(3); POSIX Error Codes.

+
+
+ + socket() + +

As returned by open/1,2.

+
+
+
-socket() - as returned by open/1,2
-
- open(Port) -> {ok, Socket} | {error, Reason} - open(Port, Options) -> {ok, Socket} | {error, Reason} + + Associate a UDP port number with the process calling it - - Port = 0..65535 - Options = [Opt] -  Opt -- see below - Socket = socket() - Reason = posix() - -

Associates a UDP port number (Port) with the calling +

Associates a UDP port number (Port) with the calling process.

The available options are:

@@ -96,7 +107,7 @@ socket() inet:setopts/2.

-

The returned socket Socket is used to send packets +

The returned socket Socket is used to send packets from this port with send/4. When UDP packets arrive at the opened port, they are delivered as messages:

@@ -110,66 +121,42 @@ socket() binary if the option binary was specified.

Default value for the receive buffer option is {recbuf, 8192}.

-

If Port == 0, the underlying OS assigns a free UDP +

If Port == 0, the underlying OS assigns a free UDP port, use inet:port/1 to retrieve it.

- send(Socket, Address, Port, Packet) -> ok | {error, Reason} + Send a packet - - Socket = socket() - Address = string() | atom() | ip_address() - Port = 0..65535 - Packet = [char()] | binary() - Reason = not_owner | posix() -

Sends a packet to the specified address and port. - The Address argument can be either a hostname, or an + The Address argument can be either a hostname, or an IP address.

- recv(Socket, Length) -> {ok, {Address, Port, Packet}} | {error, Reason} - recv(Socket, Length, Timeout) -> {ok, {Address, Port, Packet}} | {error, Reason} + + Receive a packet from a passive socket - - Socket = socket() - Length = int() - Address = ip_address() - Port = 0..65535 - Packet = [char()] | binary() - Timeout = int() | infinity - Reason = not_owner | posix() -

This function receives a packet from a socket in passive mode.

-

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 + Change controlling process of a socket - - Socket = socket() - Pid = pid() - -

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.

- close(Socket) -> ok | {error, Reason} + Close a UDP socket - - Socket = socket() - Reason = not_owner | posix() -

Closes a UDP socket.

-- cgit v1.2.3