2
.\" Title: modbus_set_socket
3
.\" Author: [see the "AUTHORS" section]
4
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
6
.\" Manual: Libmodbus Manual
7
.\" Source: libmodbus 3.0.3
10
.TH "MODBUS_SET_SOCKET" "3" "05/26/2012" "libmodbus 3\&.0\&.3" "Libmodbus Manual"
11
.\" -----------------------------------------------------------------
12
.\" * Define some portability stuff
13
.\" -----------------------------------------------------------------
14
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
.\" http://bugs.debian.org/507673
16
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20
.\" -----------------------------------------------------------------
21
.\" * set default formatting
22
.\" -----------------------------------------------------------------
23
.\" disable hyphenation
25
.\" disable justification (adjust text to left margin only)
27
.\" -----------------------------------------------------------------
28
.\" * MAIN CONTENT STARTS HERE *
29
.\" -----------------------------------------------------------------
31
modbus_set_socket \- set socket of the context
34
\fBvoid modbus_set_socket(modbus_t *\fR\fB\fIctx\fR\fR\fB, int \fR\fB\fIsocket\fR\fR\fB);\fR
37
The \fImodbus_set_socket()\fR function shall set the socket or file descriptor in the libmodbus context\&. This function is useful for managing multiple client connections to the same server\&.
40
There is no return values\&.
47
ctx = modbus_new_tcp("127\&.0\&.0\&.1", 1502);
48
server_socket = modbus_tcp_listen(ctx, NB_CONNECTION);
51
FD_SET(server_socket, &rdset);
55
if (FD_ISSET(master_socket, &rdset)) {
56
modbus_set_socket(ctx, master_socket);
57
rc = modbus_receive(ctx, query);
59
modbus_reply(ctx, query, rc, mb_mapping);
68
\fBmodbus_get_socket\fR(3)
71
The libmodbus documentation was written by St\('ephane Raimbault <\m[blue]\fBstephane\&.raimbault@gmail\&.com\fR\m[]\&\s-2\u[1]\d\s+2>
74
stephane.raimbault@gmail.com
76
\%mailto:stephane.raimbault@gmail.com