7 modbus_tcp_accept - accept a new connection on a TCP Modbus socket (IPv4)
12 *int modbus_tcp_accept(modbus_t *'ctx', int *'s);*
17 The *modbus_tcp_accept()* function shall extract the first connection on the
18 queue of pending connections, create a new socket and store it in libmodbus
19 context given in argument. If available, _accept4()_ with `SOCK_CLOEXEC` will be
20 called instead of *accept()*.
25 The function shall return a new socket if successful.
26 Otherwise it shall return -1 and set errno.
31 For detailed example, see unit-test-server.c source file in tests directory.
37 ctx = modbus_new_tcp("127.0.0.1", 502);
38 s = modbus_tcp_listen(ctx, 1);
39 modbus_tcp_accept(ctx, &s);
49 linkmb:modbus_tcp_pi_accept[3]
50 linkmb:modbus_tcp_listen[3]
51 linkmb:modbus_tcp_pi_listen[3]
55 The libmodbus documentation was written by Stéphane Raimbault
56 <stephane.raimbault@gmail.com>