Crates.io | ads-proxy |
lib.rs | ads-proxy |
version | 0.9.7 |
source | src |
created_at | 2023-06-12 00:41:54.722865 |
updated_at | 2024-11-07 08:00:53.736898 |
description | ADS proxy utility |
homepage | https://github.com/fengyc/ads-proxy |
repository | https://github.com/fengyc/ads-proxy |
max_upload_size | |
id | 887646 |
size | 47,371 |
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>
Arguments:
<PLC_ADDR> PLC address, e.g. 172.18.0.10:48898
Options:
-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. 10.10.10.10.1.1
-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: 127.0.0.1:48898]
-h, --help
Print help
-V, --version
Print version
In pyads, connect to ads-proxy
. For example, client 1 and 2 (process 1 and 2) on a host:
ams_net_id=192.168.0.10.1.1
ams_net_id=10.10.10.10.1.1
ams_net_id=10.10.10.10.1.2
Might need to add route entry in shell command with -r
or in PLC configuration,
see default user and password
ads-proxy -r 10.10.10.10.1.1 192.168.0.10:48898
client 1 (process 1)
import pyads
# x=1 or 2, process instance should have a unique ams net id
pyads.set_local_address("10.10.10.10.1.1")
plc1 = pyads.Connection(ams_net_id="192.168.0.10.1.1", ams_net_port=851, ip_address="127.0.0.1")
with plc1:
...
client 2 (process 2)
import pyads
# x=1 or 2, process instance should have a unique ams net id
pyads.set_local_address("10.10.10.10.1.2")
# 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="192.168.0.10.1.1", ams_net_port=851, ip_address="127.0.0.1")
with plc2:
...
client 1 --|
10.10.10.10.1.1 |
| multi-connections one connection
client 2 ---------------------> ads-proxy --------------> PLC
10.10.10.10.1.2 | a.b.c.d route 10.10.10.10.1.1
| a.b.c.d
client n --|
10.10.10.10.x.y
MIT