Skip to content
Start free evaluation

pdcomm_modbus_endpoint_create

Function

Creates a disconnected endpoint with the default configuration.

int32_t pdcomm_modbus_endpoint_create(pdcomm_modbus_handle *out)

Declared in: #include <pdcomm/modbus/pdcomm_modbus.h>

The new endpoint is a Modbus TCP server configuration for 127.0.0.1:0 with unit identifier 1 and a local data model of 1024 entries per table. It owns no socket or serial port until {"action":"connect"}. Local commands such as execute and data_set work immediately.

Parameters

NameDescription
outReceives the new endpoint handle; set to zero first.

Returns

#PDCOMM_MODBUS_OK, #PDCOMM_MODBUS_INVALID_INPUT for a null out, or #PDCOMM_MODBUS_INTERNAL_ERROR.

Notes

  • Release the endpoint with pdcomm_modbus_release(); releasing it closes its socket or serial port.