diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html
index 43b85d5e95a..3369857b360 100644
--- a/Documentation/NuttX.html
+++ b/Documentation/NuttX.html
@@ -645,6 +645,7 @@ Other memory:
* Implemented receive timeouts via setsockopt(SO_RCVTIMEO).
* Provide support for multiple network devices
* Implement socket ioctl() calls to set addresses
+ * Added listen() and accept()
diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html
index 8ba15218422..8485f287c00 100644
--- a/Documentation/NuttxUserGuide.html
+++ b/Documentation/NuttxUserGuide.html
@@ -21,7 +21,7 @@ User's Manual
Gregory Nutt
-Last Update: September 8, 2007
+Last Update: September 23, 2007
@@ -5780,12 +5780,14 @@ Those socket APIs are discussed in the following paragraphs.
2.12.1 socket
2.12.2 bind
2.12.3 connect
-2.12.4 send
-2.12.5 sendto
-2.12.6 recv
-2.12.7 recvfrom
-2.12.8 setsockopt
-2.12.9 getsockopt
+2.12.4 listen
+2.12.5 accept
+2.12.6 send
+2.12.7 sendto
+2.12.8 recv
+2.12.9 recvfrom
+2.12.10 setsockopt
+2.12.11 getsockopt
@@ -5951,7 +5953,122 @@ Those socket APIs are discussed in the following paragraphs.
to accept new connections.
-
+
+
+ Function Prototype:
+
+
+ #include
+ int listen(int sockfd, int backlog);
+
+
+ Description:
+ To accept connections, a socket is first created with socket(), a
+ willingness to accept incoming connections and a queue limit for incoming
+ connections are specified with listen(), and then the connections are
+ accepted with accept(). The listen() call applies only to sockets of
+ type SOCK_STREAM or SOCK_SEQPACKET.
+
+
+ Input Parameters:
+
+
+ sockfd: Socket descriptor of the bound socket.
+ backlog: The maximum length the queue of pending connections may grow.
+ If a connection request arrives with the queue full, the client may receive an error
+ with an indication of ECONNREFUSED or, if the underlying protocol supports retransmission,
+ the request may be ignored so that retries succeed.
+
+
+ Returned Values:
+ On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
+
+
+ EADDRINUSE: Another socket is already listening on the same port.
+ EBADF: The argument sockfd is not a valid descriptor.
+ ENOTSOCK: The argument sockfd is not a socket.
+ EOPNOTSUPP: The socket is not of a type that supports the listen operation.
+
+
+
+
+ Function Prototype:
+
+
+ #include
+ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+
+
+ Description:
+ The accept() function is used with connection-based socket types
+ (SOCK_STREAM, SOCK_SEQPACKET and SOCK_RDM).
+ It extracts the first connection request on the queue of pending connections,
+ creates a new connected socket with most of the same properties as sockfd,
+ and allocates a new socket descriptor for the socket, which is returned. The
+ newly created socket is no longer in the listening state. The original
+ socket sockfd is unaffected by this call. Per file descriptor flags
+ are not inherited across an accept.
+
+
+ The sockfd argument is a socket descriptor that has been created with
+ socket(), bound to a local address with bind(), and is listening for
+ connections after a call to listen().
+
+
+ On return, the addr structure is filled in with the address of the
+ connecting entity. The addrlen argument initially contains the size
+ of the structure pointed to by addr; on return it will contain the
+ actual length of the address returned.
+
+
+ If no pending connections are present on the queue, and the socket is
+ not marked as non-blocking, accept blocks the caller until a connection
+ is present. If the socket is marked non-blocking and no pending
+ connections are present on the queue, accept returns EAGAIN.
+
+
+ Input Parameters:
+
+
+ sockfd: Socket descriptor of the listening socket.
+ addr: Receives the address of the connecting client.
+ addrlen: Input: allocated size of addr, Return: returned size of addr.
+
+
+ Returned Values:
+ Returns -1 on error. If it succeeds, it returns a non-negative integer
+ that is a descriptor for the accepted socket.
+
+
+ EAGAIN or EWOULDBLOCK:
+ The socket is marked non-blocking and no connections are present to be accepted.
+ EBADF:
+ The descriptor is invalid.
+ ENOTSOCK:
+ The descriptor references a file, not a socket.
+ EOPNOTSUPP:
+ The referenced socket is not of type SOCK_STREAM.
+ EINTR:
+ The system call was interrupted by a signal that was caught before a valid connection arrived.
+ ECONNABORTED:
+ A connection has been aborted.
+ EINVAL:
+ Socket is not listening for connections.
+ EMFILE:
+ The per-process limit of open file descriptors has been reached.
+ ENFILE:
+ The system maximum for file descriptors has been reached.
+ EFAULT:
+ The addr parameter is not in a writable part of the user address space.
+ ENOBUFS or ENOMEM:
+ Not enough free memory.
+ EPROTO:
+ Protocol error.
+ EPERM:
+ Firewall rules forbid connection.
+
+
+
Function Prototype:
@@ -5983,7 +6100,7 @@ Those socket APIs are discussed in the following paragraphs.
See sendto().
-
+
Function Prototype:
@@ -6055,7 +6172,7 @@ Those socket APIs are discussed in the following paragraphs.
MSG_NOSIGNAL is set.
-
+
Function Prototype:
@@ -6086,7 +6203,7 @@ Those socket APIs are discussed in the following paragraphs.
Zero on success.
-
+
Function Prototype:
@@ -6148,7 +6265,7 @@ Those socket APIs are discussed in the following paragraphs.
The argument sockfd does not refer to a socket.
-
+
Function Prototype:
@@ -6208,7 +6325,7 @@ Those socket APIs are discussed in the following paragraphs.
Insufficient resources are available in the system to complete the call.
-
+
Function Prototype:
@@ -6469,6 +6586,7 @@ notify a task when a message is available on a queue.