---
name: "socket_accept6"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/socket_accept6"
---

# socket\_accept6(3)

accept an IPv6 TCP connection on a socket

## NAME

socket\_accept6 - accept an IPv6 TCP connection on a socket

## SYNTAX

**#include \<libowfat/socket.h\>**

int **socket\_accept6**(int *s*,char *ip*\[16\],uint16 \**port*,uint32 \**scope\_id*);

## DESCRIPTION

When a TCP connection arrives on a listening TCP socket *s*, the socket becomes readable.

socket\_accept6 accepts the connection.  It sets *ip* and *port* to the client IP address and client TCP port and *scope\_id* to the IPv6 scope ID.  It creates a new socket for the connection, and returns a file descriptor pointing to the new socket; you can use the read and write system calls to transmit data through that file descriptor.

If *scope\_id* is the null pointer, socket\_accept6 will discard the scope ID.

If something goes wrong, socket\_accept6 returns -1, setting errno appropriately, without creating a new socket.

## EXAMPLE

  \#include \<libowfat/socket.h\>

  int *s*;\
   char *ip*\[16\];\
   uint16 *port*;\
   uint32 *scope\_id*;

  *s* = socket\_tcp6();\
   socket\_bind6(s,ip,port,scope\_id);\
   socket\_listen(s,16);\
   socket\_accept6(s,ip,&port,&scope\_id);

## SEE ALSO

[socket\_accept4(3)](/socket_accept4/3.md), [socket\_connected(3)](/socket_connected/3.md)
