1socket_accept4(3)          Library Functions Manual          socket_accept4(3)
2
3
4

NAME

6       socket_accept4 - accept an IPv4 TCP connection on a socket
7

SYNTAX

9       #include <socket.h>
10
11       int socket_accept4(int s,char ip[4],uint16 *port);
12

DESCRIPTION

14       When  a  TCP connection arrives on a listening TCP socket s, the socket
15       becomes readable.
16
17       socket_accept4 accepts the connection.  It sets  ip  and  port  to  the
18       client IP address and client TCP port.  It creates a new socket for the
19       connection, and returns a file descriptor pointing to the  new  socket;
20       you  can  use  the read and write system calls to transmit data through
21       that file descriptor.
22
23       If something goes  wrong,  socket_accept4  returns  -1,  setting  errno
24       appropriately, without creating a new socket.
25
26

EXAMPLE

28         #include <socket.h>
29
30         int s;
31         char ip[4];
32         uint16 p;
33
34         s = socket_tcp4();
35         socket_bind4(s,ip,p);
36         socket_listen(s,16);
37         socket_accept4(s,ip,&p);
38
39

SEE ALSO

41       socket_accept6(3), socket_connected(3)
42
43
44
45                                                             socket_accept4(3)
Impressum