Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NetSock_Close() / close() (TCP/UDP)

...

10932381093238Terminate communication and free a socket. Anchor11239251123925

Files

...

11239261123926net_sock.h/net_sock.c Anchor

11239271123927net_bsd.h/net_bsd.c Anchor11239281123928

Prototypes

...

rowspan3

...

...

 

...

...

Arguments

...

1093247sock_id Anchor12573081257308

The socket ID returned by NetSock_Open()/socket() when the socket is created or by NetSock_Accept()/accept() when a connection is accepted.

...

perr Anchor12573151257315

Pointer to variable that will receive the return error code from this function:

...

NET_SOCK_ERR_NONE

...

...

NET_SOCK_ERR_NOT_USED

...

NET_SOCK_ERR_CLOSED

...

...

NET_SOCK_ERR_INVALID_SOCK

...

NET_SOCK_ERR_INVALID_FAMILY

...

...

NET_SOCK_ERR_INVALID_STATE

...

NET_SOCK_ERR_CLOSE_IN_PROGRESS

...

NET_SOCK_ERR_CONN_SIGNAL_TIMEOUT

...

NET_SOCK_ERR_CONN_FAIL

...

NET_SOCK_ERR_FAULT

...

NET_CONN_ERR_NULL_PTR

...

NET_CONN_ERR_NOT_USED

...

...

NET_CONN_ERR_INVALID_CONN

...

NET_CONN_ERR_INVALID_ADDR_LEN

...

...

NET_CONN_ERR_ADDR_IN_USE

...

NET_ERR_INIT_INCOMPLETE

...

NET_OS_ERR_LOCK

...

Returned Value

...

NET_SOCK_BSD_ERR_NONE/0, if successful; Anchor10932681093268

NET_SOCK_BSD_ERR_CLOSE/-1, otherwise. Anchor10932691093269

Required Configuration

...

10932701093270NetSock_Close() is available only if either NET_CFG_TRANSPORT_LAYER_SEL is configured for TCP (see section D-12-1 on page 755) and/or NET_UDP_CFG_APP_API_SEL is configured for sockets (see section D-13-1 on page 756). Anchor10932711093271

In addition, close() is available only if NET_BSD_CFG_API_EN is enabled (see section D-17-1 on page 767). Anchor10932721093272

Notes / Warnings

...

After closing a socket, no further operations should be performed with the socket.