sdk/modules/lte/altcom/api/socket/altcom_shutdown.c
/****************************************************************************
 * Name: altcom_shutdown
 *
 * Description:
 *   The altcom_shutdown() function will cause all or part of a full-duplex
 *   connection on the socket associated with the file descriptor socket to
 *   be shut down.
 *
 *   The altcom_shutdown() function disables subsequent send and/or receive
 *   operations on a socket, depending on the value of the how argument.
 *
 * Input Paramteers:
 *   sockfd - Specifies the file descriptor of the socket.
 *   how    - Specifies the type of shutdown. The values are as follows:
 *
 *     ALTCOM_SHUT_RD   - Disables further receive operations.
 *     ALTCOM_SHUT_WR   - Disables further send operations.
 *     ALTCOM_SHUT_RDWR - Disables further send and receive operations.
 *
 * Returned Value:
 *   Upon successful completion, altcom_shutdown() will return 0; otherwise,
 *   -1 will be returned and errno set to indicate the error.
 *
 ****************************************************************************/
altcom_shutdown
Description:
The altcom_shutdown() function will cause all or part of a full-duplex
connection on the socket associated with the file descriptor socket to
be shut down.

The altcom_shutdown() function disables subsequent send and/or receive
operations on a socket, depending on the value of the how argument.

Input Paramteers:
sockfd - Specifies the file descriptor of the socket.
how    - Specifies the type of shutdown. The values are as follows.

ALTCOM_SHUT_RD   - Disables further receive operations.
ALTCOM_SHUT_WR   - Disables further send operations.
ALTCOM_SHUT_RDWR - Disables further send and receive operations.

Returned Value:
Upon successful completion, altcom_shutdown() will return 0; otherwise,
-1 will be returned and errno set to indicate the error.
altcom_shutdown Description : The altcom_shutdown () function will cause all or part of a full - duplex connection on the socket associated with the file descriptor socket to be shut down . The altcom_shutdown () function disables subsequent send and / or receive operations on a socket depending on the value of the how argument . Input Paramteers : sockfd - Specifies the file descriptor of the socket . how - Specifies the type of shutdown . The values are as follows . ALTCOM_SHUT_RD - Disables further receive operations . ALTCOM_SHUT_WR - Disables further send operations . ALTCOM_SHUT_RDWR - Disables further send and receive operations . Returned Value : Upon successful completion altcom_shutdown () will return 0 ; otherwise - 1 will be returned and errno set to indicate the error .
int altcom_shutdown(int sockfd, int how)
{
  int32_t                    result;
  FAR struct altcom_socket_s *fsock;
  struct shutdown_req_s      req;
  if (!altcom_isinit())
    {
      DBGIF_LOG_ERROR("Not intialized\n");
      altcom_seterrno(ALTCOM_ENETDOWN);
      return -1;
    }
  fsock = altcom_sockfd_socket(sockfd);
  if (!fsock)
    {
      altcom_seterrno(ALTCOM_EINVAL);
      return -1;
    }
  req.sockfd = sockfd;
  req.how    = how;
  result = shutdown_request(fsock, &req);
  if (result == SHUTDOWN_REQ_FAILURE)
   {
     return -1;
   }
  return 0;
}
int altcom_shutdown ( int sockfd , int how ) { int32_t result ; FAR struct altcom_socket_s * fsock ; struct shutdown_req_s req ; if ( ! altcom_isinit ( ) ) { DBGIF_LOG_ERROR ( " \n " ) ; altcom_seterrno ( ALTCOM_ENETDOWN ) ; return -1 ; } fsock = altcom_sockfd_socket ( sockfd ) ; if ( ! fsock ) { altcom_seterrno ( ALTCOM_EINVAL ) ; return -1 ; } req . sockfd = sockfd ; req . how = how ; result = shutdown_request ( fsock , & req ) ; if ( result == SHUTDOWN_REQ_FAILURE ) { return -1 ; } return 0 ; }
Name: altcom_shutdown
 Description:
   The altcom_shutdown() function will cause all or part of a full-duplex
   connection on the socket associated with the file descriptor socket to
   be shut down.
Name : altcom_shutdown Description : The altcom_shutdown () function will cause all or part of a full - duplex connection on the socket associated with the file descriptor socket to be shut down .