|
@@ -0,0 +1,64 @@
|
|
|
+modbus_tcp_pi_listen(3)
|
|
|
+=======================
|
|
|
+
|
|
|
+
|
|
|
+NAME
|
|
|
+----
|
|
|
+modbus_tcp_pi_listen - create and listen a TCP PI Modbus socket (IPv6)
|
|
|
+
|
|
|
+
|
|
|
+SYNOPSIS
|
|
|
+--------
|
|
|
+*int modbus_tcp_pi_listen(modbus_t *'ctx', int 'nb_connection');*
|
|
|
+
|
|
|
+
|
|
|
+DESCRIPTION
|
|
|
+-----------
|
|
|
+The _modbus_tcp_pi_listen()_ function shall create a socket and listen for
|
|
|
+'nb_connection' incoming connections.
|
|
|
+
|
|
|
+
|
|
|
+RETURN VALUE
|
|
|
+------------
|
|
|
+The _modbus_tcp_listen()_ function shall return a new socket if
|
|
|
+successful. Otherwise it shall return -1 and set errno.
|
|
|
+
|
|
|
+
|
|
|
+EXAMPLE
|
|
|
+-------
|
|
|
+
|
|
|
+For detailed examples, see source files in tests directory:
|
|
|
+
|
|
|
+- unit-test-server.c, simple but handle only one connection
|
|
|
+
|
|
|
+[source,c]
|
|
|
+-------------------
|
|
|
+...
|
|
|
+
|
|
|
+ctx = modbus_new_tcp_pi("::0", "502");
|
|
|
+s = modbus_tcp_pi_listen(ctx, 1);
|
|
|
+modbus_tcp_pi_accept(ctx, &s);
|
|
|
+
|
|
|
+for (;;) {
|
|
|
+ rc = modbus_receive(ctx, query);
|
|
|
+ modbus_replay(ctx, query, rc, mb_mapping);
|
|
|
+}
|
|
|
+...
|
|
|
+
|
|
|
+mclose(s);
|
|
|
+modbus_free(ctx);
|
|
|
+-------------------
|
|
|
+
|
|
|
+- bandwith-server-many-up.c, handles several connections at once
|
|
|
+
|
|
|
+
|
|
|
+SEE ALSO
|
|
|
+--------
|
|
|
+linkmb:modbus_tcp_pi_accept[3]
|
|
|
+linkmb:modbus_tcp_accept[3]
|
|
|
+linkmb:modbus_tcp_listen[3]
|
|
|
+
|
|
|
+AUTHORS
|
|
|
+-------
|
|
|
+The libmodbus documentation was written by Stéphane Raimbault
|
|
|
+<stephane.raimbault@gmail.com>
|