~ubuntu-branches/ubuntu/utopic/libmodbus/utopic

« back to all changes in this revision

Viewing changes to doc/modbus_set_socket.3

  • Committer: Package Import Robot
  • Author(s): Ivo De Decker
  • Date: 2013-06-30 12:25:01 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20130630122501-13vkglrt4xzalz1p
Tags: 3.0.4-1
* New upstream release 
* Update standards-version to 3.9.4 (no changes) 
* Enable parallel build
* Enable verbose build to show compiler flags to build log checks 
* Update watch file to filter out unstable versions 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
'\" t
2
 
.\"     Title: modbus_set_socket
3
 
.\"    Author: [see the "AUTHORS" section]
4
 
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
5
 
.\"      Date: 05/26/2012
6
 
.\"    Manual: Libmodbus Manual
7
 
.\"    Source: libmodbus 3.0.3
8
 
.\"  Language: English
9
 
.\"
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
 
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18
 
.ie \n(.g .ds Aq \(aq
19
 
.el       .ds Aq '
20
 
.\" -----------------------------------------------------------------
21
 
.\" * set default formatting
22
 
.\" -----------------------------------------------------------------
23
 
.\" disable hyphenation
24
 
.nh
25
 
.\" disable justification (adjust text to left margin only)
26
 
.ad l
27
 
.\" -----------------------------------------------------------------
28
 
.\" * MAIN CONTENT STARTS HERE *
29
 
.\" -----------------------------------------------------------------
30
 
.SH "NAME"
31
 
modbus_set_socket \- set socket of the context
32
 
.SH "SYNOPSIS"
33
 
.sp
34
 
\fBvoid modbus_set_socket(modbus_t *\fR\fB\fIctx\fR\fR\fB, int \fR\fB\fIsocket\fR\fR\fB);\fR
35
 
.SH "DESCRIPTION"
36
 
.sp
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\&.
38
 
.SH "RETURN VALUE"
39
 
.sp
40
 
There is no return values\&.
41
 
.SH "EXAMPLE"
42
 
.sp
43
 
.if n \{\
44
 
.RS 4
45
 
.\}
46
 
.nf
47
 
ctx = modbus_new_tcp("127\&.0\&.0\&.1", 1502);
48
 
server_socket = modbus_tcp_listen(ctx, NB_CONNECTION);
49
 
 
50
 
FD_ZERO(&rdset);
51
 
FD_SET(server_socket, &rdset);
52
 
 
53
 
/* \&.\&.\&.\&. */
54
 
 
55
 
if (FD_ISSET(master_socket, &rdset)) {
56
 
    modbus_set_socket(ctx, master_socket);
57
 
    rc = modbus_receive(ctx, query);
58
 
    if (rc != \-1) {
59
 
        modbus_reply(ctx, query, rc, mb_mapping);
60
 
    }
61
 
}
62
 
.fi
63
 
.if n \{\
64
 
.RE
65
 
.\}
66
 
.SH "SEE ALSO"
67
 
.sp
68
 
\fBmodbus_get_socket\fR(3)
69
 
.SH "AUTHORS"
70
 
.sp
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>
72
 
.SH "NOTES"
73
 
.IP " 1." 4
74
 
stephane.raimbault@gmail.com
75
 
.RS 4
76
 
\%mailto:stephane.raimbault@gmail.com
77
 
.RE