Browse Source

Add documentation for modbus_tcp_pi_listen

Stéphane Raimbault 11 năm trước cách đây
mục cha
commit
ffd2d691bf
2 tập tin đã thay đổi với 65 bổ sung0 xóa
  1. 1 0
      doc/Makefile.am
  2. 64 0
      doc/modbus_tcp_pi_listen.txt

+ 1 - 0
doc/Makefile.am

@@ -46,6 +46,7 @@ MAN3 = \
         modbus_set_socket.3 \
         modbus_strerror.3 \
         modbus_tcp_listen.3 \
+        modbus_tcp_pi_listen.3 \
         modbus_write_and_read_registers.3 \
         modbus_write_bits.3 \
         modbus_write_bit.3 \

+ 64 - 0
doc/modbus_tcp_pi_listen.txt

@@ -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>