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

1.0 Introduction

@@ -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
  • 2.12.1 socket

    @@ -5951,7 +5953,122 @@ Those socket APIs are discussed in the following paragraphs.

    to accept new connections. -

    2.12.4 send

    +

    2.12.4 listen

    +

    + 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: +

    + +

    + Returned Values: + On success, zero is returned. On error, -1 is returned, and errno is set appropriately. +

    + + +

    2.12.5 accept

    +

    + 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: +

    + +

    + Returned Values: + Returns -1 on error. If it succeeds, it returns a non-negative integer + that is a descriptor for the accepted socket. +

    + + +

    2.12.6 send

    Function Prototype:

    @@ -5983,7 +6100,7 @@ Those socket APIs are discussed in the following paragraphs.

    See sendto().

    -

    2.12.5 sendto

    +

    2.12.7 sendto

    Function Prototype:

    @@ -6055,7 +6172,7 @@ Those socket APIs are discussed in the following paragraphs.

    MSG_NOSIGNAL is set. -

    2.12.6 recv

    +

    2.12.8 recv

    Function Prototype:

    @@ -6086,7 +6203,7 @@ Those socket APIs are discussed in the following paragraphs.

    Zero on success.

    -

    2.12.7 recvfrom

    +

    2.12.9 recvfrom

    Function Prototype:

    @@ -6148,7 +6265,7 @@ Those socket APIs are discussed in the following paragraphs.

    The argument sockfd does not refer to a socket. -

    2.12.8 setsockopt

    +

    2.12.10 setsockopt

    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. -

    2.12.9 getsockopt

    +

    2.12.11 getsockopt

    Function Prototype:

    @@ -6469,6 +6586,7 @@ notify a task when a message is available on a queue.
    +
  • accept
  • bind
  • clock_getres
  • clock_gettime
  • @@ -6485,6 +6603,7 @@ notify a task when a message is available on a queue.
  • gmtime_r
  • Introduction
  • kill
  • +
  • listen
  • localtime_r
  • Named Message Queue Interfaces
  • mktime
  • @@ -6541,9 +6660,9 @@ notify a task when a message is available on a queue.
  • pthread_mutexattr_init
  • pthread_mutexattr_setpshared
  • pthread_mutex_destroy
  • -
  • pthread_mutex_init
  • +
  • pthread_mutex_init
  • pthread_mutex_lock
  • pthread_mutex_trylock
  • pthread_mutex_unlock