Some of the newer Zaber devices (e.g. X-MCC) support ethernet and the TCP/IP protocol. Alternatively, the serial port connection can be forwarded to TCP/IP using a 3rd party ethernet-serial converter or a simple program. In this scenario, the Zaber device (or a hardware converter) acts as a TCP server and the library as a TCP client.
In order to communicate with a TCP server, you need to know its hostname or IP address and on what TCP port the server is listening.
For Zaber devices, the hostname is in format zaber- <serial number>.local,
or you can obtain the IP address from the comm.en.ipv4.address setting.
The TCP port choice depends on your setup.
If you'd like to communicate with the entire device chain, choose port 55550 represented by the TCP_PORT_CHAIN constant.
If you'd like to communicate only with the ethernet device, choose port 55551 represented by the TCP_PORT_DEVICE_ONLY constant.
Using TCP_PORT_DEVICE_ONLY is typically faster as the device does not need to forward the commands to the rest of the chain over a slower serial connection.
For more details, see the Protocol Manual.
For a 3rd party converter, the manufacturer specifies the hostname and the TCP port.
In the following example, the device has a hostname "zaber-12345.local".
with Connection.open_tcp("zaber-12345.local", Connection.TCP_PORT_CHAIN) as connection:
device_list = connection.detect_devices()
print("Found {} devices".format(len(device_list)))
# rest of your program goes here (indented)
The example program attempts to connect to a TCP server and detect present devices. If you encounter a problem while connecting, make sure that the server listens on the specified port and is reachable on the network.
API Reference:
open_tcp
method