3 releases

0.9.5 Jun 14, 2023
0.9.4 Jun 14, 2023
0.9.2 Jun 12, 2023

#1814 in Network programming

Download history 4/week @ 2023-11-13 6/week @ 2023-11-20 14/week @ 2023-11-27 3/week @ 2023-12-11 9/week @ 2023-12-25 1/week @ 2024-01-01 16/week @ 2024-01-29 1/week @ 2024-02-05 20/week @ 2024-02-12 104/week @ 2024-02-19

141 downloads per month

MIT license

377 lines

ADS proxy


This is a Beckhoff ADS proxy that could resolve multiple tcp connections with same ip address issues.


Download binary from github release page or cargo install ads-proxy, then run ads-proxy.

ADS proxy utility

Usage: ads-proxy [OPTIONS] <PLC_ADDR>

  <PLC_ADDR>  PLC address, e.g.

  -d, --debug
          Debug mode
  -b, --buffer-size <BUFFER_SIZE>
          Buffer size (maximum size of a AMS packet) [default: 65536]
  -q, --queue-size <QUEUE_SIZE>
          Queue size (cached packets per connection) [default: 128]
  -r, --route-ams-net-id <ROUTE_AMS_NET_ID>
          Optional ams net id route, e.g.
  -u, --username <USERNAME>
          Optional PLC username (to add route)
  -p, --password <PASSWORD>
          Optional PLC password (to add route)
      --route-host <ROUTE_HOST>
          Optional Proxy hostname (hostname or ip address, detected from PLC connection)
  -l, --listen-addr <LISTEN_ADDR>
          Proxy listen address [default:]
  -h, --help
          Print help
  -V, --version
          Print version

In pyads, connect to ads-proxy. For example, client 1 and 2 on a host:

  • plc ams_net_id=
  • client 1 ams_net_id=
  • client 2 ams_net_id=

Might need to add route entry in shell command with -r or in PLC configuration, see default user and password

ads-proxy -r
import pyads

# x=1 or 2, process instance should have a unique ams net id

plc1 = pyads.Connection(ams_net_id="", ams_net_port=851, ip_address="")
with plc1:

# app can create multiple ADS connections
# the packets will be sent in ONE tcp connection in a process instance
plc2 = pyads.Connection(ams_net_id="", ams_net_port=851, ip_address="")
with plc2:

How it works

client 1        --|   |
                  | multi-connections            one connection
client 2        ---------------------> ads-proxy --------------> PLC   |                    a.b.c.d          route
                  |                                            a.b.c.d
client n        --|




~255K SLoC