31 int main(
int argc,
char *argv[])
41 if (strcmp(argv[1],
"tcp") == 0) {
43 }
else if (strcmp(argv[1],
"rtu") == 0) {
46 printf(
"Usage:\n %s [tcp|rtu] - Modbus client to measure data bandwith\n\n", argv[0]);
54 if (use_backend ==
TCP) {
67 if (mb_mapping == NULL) {
68 fprintf(stderr,
"Failed to allocate the mapping: %s\n",
modbus_mapping_t * modbus_mapping_new(int nb_coil_status, int nb_input_status, int nb_holding_registers, int nb_input_registers)
int modbus_receive(modbus_t *ctx, uint8_t *req)
#define MODBUS_TCP_MAX_ADU_LENGTH
void modbus_free(modbus_t *ctx)
#define MODBUS_MAX_READ_REGISTERS
int modbus_set_slave(modbus_t *ctx, int slave)
int modbus_reply(modbus_t *ctx, const uint8_t *req, int req_length, modbus_mapping_t *mb_mapping)
int modbus_tcp_accept(modbus_t *ctx, int *socket)
int main(int argc, char *argv[])
int modbus_tcp_listen(modbus_t *ctx, int nb_connection)
const char * modbus_strerror(int errnum)
void modbus_mapping_free(modbus_mapping_t *mb_mapping)
modbus_t * modbus_new_rtu(const char *device, int baud, char parity, int data_bit, int stop_bit)
int modbus_connect(modbus_t *ctx)
modbus_mapping_t * mb_mapping
#define MODBUS_MAX_READ_BITS
modbus_t * modbus_new_tcp(const char *ip_address, int port)