MODBUS_SET_SLAVE(3) Libmodbus Manual MODBUS_SET_SLAVE(3)NAME
modbus_set_slave - set slave number in the context
SYNOPSIS
int modbus_set_slave(modbus_t *ctx, int slave);
DESCRIPTION
The modbus_set_slave() function shall set the slave number in the libmodbus context.
The behavior depends of network and the role of the device:
RTU
Define the slave ID of the remote device to talk in master mode or set the internal slave ID in slave mode. According to the protocol,
a Modbus device must only accept message holing its slave number or the special broadcast number.
TCP
The slave number is only required in TCP if the message must reach a device on a serial network. The special value MODBUS_TCP_SLAVE
(0xFF) can be used in TCP mode to restore the default value.
The broadcast address is MODBUS_BROADCAST_ADDRESS. This special value must be use when you want all Modbus devices of the network receive
the request.
RETURN VALUE
The modbus_set_slave() function shall return 0 if successful. Otherwise it shall return -1 and set errno to one of the values defined
below.
ERRORS
EINVAL
The slave number is invalid.
AUTHORS
The libmodbus documentation was written by Stephane Raimbault <stephane.raimbault@gmail.com[1]>
NOTES
1. stephane.raimbault@gmail.com
mailto:stephane.raimbault@gmail.com
libmodbus 3.0.3 05/26/2012 MODBUS_SET_SLAVE(3)
Check Out this Related Man Page
MODBUS_NEW_TCP_PI(3) Libmodbus Manual MODBUS_NEW_TCP_PI(3)NAME
modbus_new_tcp_pi - create a libmodbus context for TCP Protocol Independent
SYNOPSIS
modbus_t *modbus_new_tcp_pi(const char *node, const char *service);
DESCRIPTION
The modbus_new_tcp_pi() function shall allocate and initialize a modbus_t structure to communicate with a Modbus TCP IPv4 or Ipv6 server.
The node argument specifies the host name or IP address of the host to connect to, eg. 192.168.0.5 , ::1 or server.com.
The service argument is the service name/port number to connect to. To use the default Modbus port use the string "502". On many Unix
systems, it's convenient to use a port number greater than or equal to 1024 because it's not necessary to have administrator privileges.
RETURN VALUE
The modbus_new_tcp_pi() function shall return a pointer to a modbus_t structure if successful. Otherwise it shall return NULL and set errno
to one of the values defined below.
ERRORS
EINVAL
The node string is empty or has been truncated. The service string is empty or has been truncated.
EXAMPLE
modbus_t *ctx;
ctx = modbus_new_tcp_pi("::1", "1502");
if (ctx == NULL) {
fprintf(stderr, "Unable to allocate libmodbus context
");
return -1;
}
if (modbus_connect(ctx) == -1) {
fprintf(stderr, "Connection failed: %s
", modbus_strerror(errno));
modbus_free(ctx);
return -1;
}
SEE ALSO modbus_new_tcp(3)modbus_new_rtu(3)modbus_free(3)AUTHORS
The libmodbus documentation was written by Stephane Raimbault <stephane.raimbault@gmail.com[1]>
NOTES
1. stephane.raimbault@gmail.com
mailto:stephane.raimbault@gmail.com
libmodbus 3.0.3 05/26/2012 MODBUS_NEW_TCP_PI(3)
hi. i configured a master and slave bind server on my vmware test network. i used nslookup to the slave name server to lookup a fake entry for network.com that the master dns set, however, the slave is resolving the real ip of www.network.com, instead of what the master dns server set. i checked... (2 Replies)
I have software running under AIX 5.3 that should communicate with a special device using standard communication protocol (Modbus) using serial RS-232 line
The settings are correct in both sides, But I can't establish a connection.
I suspect that there's something that I should do regarding the... (3 Replies)
I was analyzing a TCP snoop. And found following scenario
From Server to Client ---> SEQ 2993 ACK 1744 WIN 8192 LEN 13
From Server to Client ---> SEQ 3006 ACK 1744 WIN 8192 LEN 13
From Client to server --> SEQ 1744 ACK 3019 WIN 3304
I just want to know Why Packet 1 and 2... (3 Replies)
bond0 active in eth0 and inactive in eth4. why eth4 received network package?
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: eth0 (primary_reselect failure)
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
... (4 Replies)