EoE (Ethernet over EtherCAT)
EoE tunnels Ethernet frames into the EtherCAT mailbox. It is used to confirm that a slave is reachable on the network (Ping), to send and receive raw Ethernet frames, to configure the slave IP/MAC/DNS, and to read the MAC address filter table. It is not an operating-system network adapter: it creates no TAP/tun device, performs no DHCP/NAT, and the whole-frame limit is 2016 bytes, so anything larger is rejected outright.
Accessed through slave.eoe (created lazily, always returns an object). Whether a slave supports EoE is queried with slave.eoe.is_supported (a property on the base EoE; a method that accepts a mailbox protocol bit field on EoEAdvanced). It returns three states: True supported / False SII confirms it is not declared / None the read failed or the evidence is insufficient (unknown).
EoEAdvancedslave.eoe always returns the base EoE. The EoEAdvanced / ping / add_address_filter / remove_address_filter members of the set_receive_hook subclass have no public entry point in the current version that returns an instance of that subclass; do not write production code against these paths. Available alternatives:
- For Ping, use
EoEPinger(slave.eoe).ping(...)(examples on this page); - To read filters, use
slave.eoe.get_address_filters()/set_address_filters(); - To send and receive frames, use
slave.eoe.send_frame()/receive_frame().
Method overview
| Category | Method | Type | Read/write | Description |
|---|---|---|---|---|
| Network configuration | set_ip / get_ip | bool / tuple or None | read/write | Reads and writes the IP, subnet mask and gateway (all uint32) |
| set_mac / get_mac | bool / bytes or None | read/write | Reads and writes the slave MAC address (6 bytes) | |
| set_dns / get_dns | bool / tuple or None | read/write | Reads and writes the DNS server address and name | |
| set_full_param / get_full_param | bool / tuple or None | read/write | Reads and writes the complete network configuration in one call | |
| Frame send/receive | send_frame | bool | write-only | Sends one Ethernet frame; returns False when it exceeds 2016 bytes |
| receive_frame | bytes or None | read-only | Retrieves one Ethernet frame; returns None when no frame is available | |
| Address filtering | get_address_filters | list or None | read-only | Reads the current MAC filter list |
| set_address_filters | bool | write-only | Sets the whole MAC filter list; an empty list clears it | |
| Connectivity | EoEPinger.ping | float or None | read-only | Sends an ICMP Echo to the target IP through EoEPinger and returns the round-trip time in milliseconds |
| EoEPinger.update_arp_cache | None | write-only | Writes one IP→MAC entry into the ARP cache of EoEPinger |
Properties
| Category | Property | Type | Read/write | Description |
|---|---|---|---|---|
| Capability | is_supported | bool or None | read-only | A property on the base EoE: True supported / False SII confirms it is not declared / None unknown |
Honest boundaries
EoE in this SDK is an EtherCAT Mailbox Ethernet frame tunnel, not an operating-system network adapter.
- No TAP / tun: creates no Windows TAP or Linux tun/tap device
- No DHCP server / NAT: does not assign addresses and does not route/NAT
- No automatic fragmentation at MTU 1500: fragmentation is done by the underlying library in 32-byte blocks per ETG.1000.6 §5.7; the whole-frame limit is the Frame Offset (6 bit × 32 B) = 2016 bytes. Frames larger than 2016 bytes are rejected by the wrapper layer
- Receive buffer:
receive_framecopies according to the frame length returned by the underlying library; the maximum is likewise bound by 2016 and is not an arbitrary size
Network configuration methods
slave.eoe is the base EoEslave.eoe returns a base EoE instance, and network configuration goes through paired setter/getter methods (not properties). Frame send/receive (send_frame / receive_frame) is already provided on the base EoE; Ping / ARP / asynchronous receive hooks / frame send/receive with a timeout are provided by EoEAdvanced.
The base EoE provides the following paired methods to read and write the slave network parameters:
| Category | Method | Read/write | Description |
|---|---|---|---|
| Network configuration | set_ip(ip, subnet, gateway) / get_ip() | read/write | IP / subnet mask / gateway (all parameters are uint32) |
set_mac(mac) / get_mac() | read/write | MAC address (6 bytes) | |
set_dns(dns_ip, dns_name="") / get_dns() | read/write | DNS server address and name | |
set_full_param(...) / get_full_param() | read/write | Reads and writes the complete network configuration in one call | |
set_address_filters(filters) / get_address_filters(max_filters=16) | read/write | MAC address filter list | |
send_frame(data) / receive_frame() | read/write | Ethernet frame send/receive |
Example:
import struct, socket
if slave.eoe.is_supported is not False: # try for both True / None (unknown); skip only when SII confirms it is not declared
# read
result = slave.eoe.get_ip()
if result is not None:
print(f"IP: {socket.inet_ntoa(struct.pack('!I', result[0]))}")
# write
ip = struct.unpack('!I', socket.inet_aton('192.168.1.100'))[0]
subnet = struct.unpack('!I', socket.inet_aton('255.255.255.0'))[0]
gateway = struct.unpack('!I', socket.inet_aton('192.168.1.1'))[0]
slave.eoe.set_ip(ip, subnet, gateway)
slave.eoe.set_mac(bytes([0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF]))
Address filters (ETG.1020)
get_address_filters()
def get_address_filters(self, max_filters: int = 16) -> Optional[List[bytes]]
Gets the MAC address filter list; each filter is a 6-byte MAC address.
set_address_filters()
def set_address_filters(self, filters: List[bytes]) -> bool
Sets the MAC address filter list. Each element is a 6-byte MAC address; an empty list clears the filters.
Example:
mac = bytes([0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF])
slave.eoe.set_address_filters([mac])
filters = slave.eoe.get_address_filters()
for f in filters or []:
print(f"过滤器: {':'.join(f'{b:02X}' for b in f)}") # Filter: {':'.join(f'{b:02X}' for b in f)}
slave.eoe.set_address_filters([]) # clear
EoEAdvancedset_address_filter() / get_address_filter() / clear_address_filters() and their *_async versions are methods of the EoEAdvanced subclass. No public entry point returns an instance of that subclass (see the note at the top of the page), so for reading and writing filters in production code use slave.eoe.get_address_filters() / set_address_filters() from the previous section; use the interfaces in this section only when you construct EoEAdvanced(dll, master_index, slave_index) yourself.
Compared with the base version, every method in this section takes timeout_ms (milliseconds, default 500), which overrides the timeout of this instance for the current call only and is restored afterwards.
set_address_filter()
def set_address_filter(self, filter_count: int, mac_filters: List[bytes],
timeout_ms: int = DEFAULT_TIMEOUT_MS) -> bool
Sets the whole MAC address filter table in a single write.
Parameters:
filter_count(int) — number of entries to send; takes the firstmac_filtersitems offilter_count; a value above the limit of 16 throwsValueError. A value below the list length leaves the extra items unsent; a value above the list length is not paddedmac_filters(List[bytes]) — MAC address list; every element that takes part in the write must be 6 bytes, otherwiseValueErroris thrown; an empty list is equivalent to clearingtimeout_ms(int) — timeout for this call (milliseconds), default 500
Returns:
bool— whether the write succeeded; returnsFalseon a communication failure and does not throw
Example:
from darra_ethercat.slave.eoe import EoEAdvanced
eoe_adv = EoEAdvanced(dll, master.master_index, slave.slave_num)
macs = [
bytes([0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF]),
bytes([0x11, 0x22, 0x33, 0x44, 0x55, 0x66]),
]
if not eoe_adv.set_address_filter(2, macs, timeout_ms=1000):
print("过滤器下发失败") # Failed to send the filter
get_address_filter()
def get_address_filter(self, max_filters: int = MAX_ADDRESS_FILTERS,
timeout_ms: int = DEFAULT_TIMEOUT_MS) -> Optional[List[bytes]]
Reads the current MAC address filter list. Three states: a list = the filters that were read (6 bytes each); [] = the read succeeded and confirms that no filter is configured (no filtering); None = the read failed, which does not mean "no filters".
Parameters:
max_filters(int) — maximum number of entries to read, default 16timeout_ms(int) — timeout for this call (milliseconds), default 500
Returns:
List[bytes] | None— MAC address list; an empty list means there really are no filters; returnsNonewhen the read fails
Example:
filters = eoe_adv.get_address_filter()
if filters is None:
print("读取过滤器失败") # Failed to read the filter
elif not filters:
print("没有配置过滤器(不过滤)") # No filter configured (no filtering)
else:
for mac in filters:
print(':'.join(f'{b:02X}' for b in mac))
clear_address_filters()
def clear_address_filters(self, timeout_ms: int = DEFAULT_TIMEOUT_MS) -> bool
Clears all filters; equivalent to set_address_filter(0, []).
Parameters:
timeout_ms(int) — timeout for this call (milliseconds), default 500
Returns:
bool— whether the clearing succeeded
Example:
if not eoe_adv.clear_address_filters():
print("清空过滤器失败") # Failed to clear the filter
The *_async methods run the synchronous call on an EoE-dedicated thread pool, so await does not block the event loop. The await timeout budget is set_address_filter_async (milliseconds) for get_address_filter_async / timeout_ms + 100; on timeout asyncio.TimeoutError is thrown, but the underlying synchronous call is not interrupted and the thread keeps running to completion.
set_address_filter_async()
async def set_address_filter_async(self, filter_count: int,
mac_filters: List[bytes],
timeout_ms: int = DEFAULT_TIMEOUT_MS) -> bool
The asynchronous version of set_address_filter(); the parameter semantics and the return value are the same, and so is validation (ValueError is thrown when the entry count exceeds 16 or a MAC is not 6 bytes).
Parameters:
filter_count(int) — number of entries to send; takes the first items ofmac_filtersmac_filters(List[bytes]) — MAC address list; every element that takes part in the write must be 6 bytestimeout_ms(int) — timeout per step (milliseconds), default 500
Returns:
bool— whether the write succeeded
Example:
mac = bytes([0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF])
if await eoe_adv.set_address_filter_async(1, [mac], timeout_ms=1000):
print("过滤器已下发") # Filter sent
get_address_filter_async()
async def get_address_filter_async(self,
max_filters: int = MAX_ADDRESS_FILTERS,
timeout_ms: int = DEFAULT_TIMEOUT_MS
) -> Optional[List[bytes]]
The asynchronous version of get_address_filter(); the three-state semantics are the same: a list = filters were read; [] = confirmed that there are no filters; None = the read failed.
Parameters:
max_filters(int) — maximum number of entries to read, default 16timeout_ms(int) — timeout per step (milliseconds), default 500
Returns:
List[bytes] | None— filter list; returnsNonewhen the read fails
Example:
filters = await eoe_adv.get_address_filter_async()
if filters is None:
print("读取失败,不要当成没有过滤器") # Read failed — do not treat this as having no filter
Both methods follow "read the current table → modify → write the whole table back". If reading the existing list returns None (communication failure), the code treats it as an empty table: add then sends only that one MAC, and remove clears the filters. When the current entries must not be overwritten by mistake, first take a non-get_address_filter() table with None and then call set_address_filter() yourself.
add_address_filter_async()
async def add_address_filter_async(self, mac_address: bytes,
timeout_ms: int = DEFAULT_TIMEOUT_MS
) -> bool
Appends one MAC address to the end of the existing filter list; an address that is already present is not added again.
Parameters:
mac_address(bytes) — MAC address to add; must be 6 bytes, otherwiseValueErroris throwntimeout_ms(int) — timeout per step (milliseconds), default 500; the wait budget for the whole call (read + write) istimeout_ms × 2 + 200
Returns:
bool— whether the write-back succeeded; returnsFalsewhen the list is already full with 16 entries
Example:
mac = bytes([0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF])
if not await eoe_adv.add_address_filter_async(mac):
print("添加失败(列表已满或写回失败)") # Add failed (list full or write-back failed)
remove_address_filter_async()
async def remove_address_filter_async(self, mac_address: bytes,
timeout_ms: int = DEFAULT_TIMEOUT_MS
) -> bool
Removes one MAC address from the filter list; when the address is not in the table the original table is written back unchanged, and the result still depends on whether that write-back succeeds.
Parameters:
mac_address(bytes) — MAC address to remove; must be 6 bytes, otherwiseValueErroris throwntimeout_ms(int) — timeout per step (milliseconds), default 500; the wait budget for the whole call istimeout_ms × 2 + 200
Returns:
bool— whether the write-back succeeded
Example:
if await eoe_adv.remove_address_filter_async(mac):
print("已移除") # Removed
Capability detection
is_supported
# base EoE (slave.eoe): property
@property
def is_supported(self) -> Optional[bool]
# EoEAdvanced method
def is_supported(self, mailbox_protocols: Optional[int] = None) -> Optional[bool]
Reports whether the slave supports EoE and returns three states: True supported / False SII confirms it is not declared / None the read failed or the evidence is insufficient (unknown).
Parameters (only EoEAdvanced.is_supported):
mailbox_protocols(int, optional) — the slave mailbox protocol bit field (read from the ESI or SII). Omitted /None/0= read SIImbx_protoon the spot; a value other than 0 is judged by that bit field
Decision basis: the EoE mailbox protocol bit is bit 1 (0x02, ECT_MBXPROT_EOE). The old implementation used 0x20 (the VoE bit) to test for EoE, which misclassified VoE-only slaves as supporting EoE; this has been changed to bit 1.
Example:
from darra_ethercat.slave.eoe import EoEAdvanced
cap = slave.eoe.is_supported # base EoE property, tri-state
if cap is None:
print("EoE 能力未知 (SII 读取失败)") # EoE capability unknown (SII read failed)
elif not cap:
print("从站不支持 EoE") # The slave does not support EoE
# explicit bit-field judgement goes through EoEAdvanced (no public entry point returns an instance of
# this subclass, see the top of the page; usable only when you obtain the runtime handles yourself)
adv = EoEAdvanced(slave._dll, slave._mi, slave._si)
print(adv.is_supported()) # read SII on the spot
print(adv.is_supported(0x02)) # judge by the explicit bit field
Ethernet frame send/receive
send_frame()
def send_frame(self, data: bytes) -> bool
Sends an Ethernet frame. Fragmentation is done by the underlying library (ETG.1000.6 §5.7). The whole frame may be larger than the slave mailbox; it is rejected only when it exceeds the Frame Offset limit (2016 bytes). There is no TAP/DHCP/NAT and no automatic fragmentation at MTU 1500.
receive_frame()
def receive_frame(self) -> Optional[bytes]
Receives an Ethernet frame, returns the frame data, and returns None on failure.
EoEAdvanced also has frame send/receive with a timeout parameter (default 500 ms):
def send_frame_data(self, frame_data: bytes, timeout_ms: int = 500) -> bool
def receive_frame_data(self, timeout_ms: int = 500) -> Optional[bytes]
send_frame_with_timestamp()
def send_frame_with_timestamp(self, frame_data: bytes, timestamp: int,
timeout_ms: int = DEFAULT_TIMEOUT_MS) -> bool
Sends the frame with an 8-byte timestamp appended at the end (ETG.1000.6 §5.7 TimeAppended), for receivers that need to align to DC time.
Parameters:
frame_data(bytes) — Ethernet frame data; empty data throwsValueErrortimestamp(int) — timestamp to append, DC time (nanoseconds), packed as an 8-byte little-endian unsigned integer; a value outside0..2^64-1throwsstruct.errortimeout_ms(int) — send timeout (milliseconds), default 500
Returns:
bool— whether the send succeeded; returnsFalsewhen the total length with the timestamp appended exceeds 2016 bytes (that is, the original frame may be at most 2008 bytes)
Example:
# dc_time_ns comes from your DC time base (nanoseconds)
if not eoe_adv.send_frame_with_timestamp(frame, dc_time_ns, timeout_ms=1000):
print("带时间戳的帧发送失败") # Failed to send the timestamped frame
send_frame_async()
async def send_frame_async(self, frame_data: bytes,
timeout_ms: int = DEFAULT_TIMEOUT_MS) -> bool
The asynchronous version of send_frame_data(): the synchronous send runs on an EoE-dedicated thread pool, so await does not block the event loop.
Parameters:
frame_data(bytes) — Ethernet frame data; empty data throwsValueErrortimeout_ms(int) — send timeout (milliseconds), default 500; this is also the wait budget forawait
Returns / exceptions:
bool— whether the send succeeded; returnsFalsewhen the frame exceeds 2016 bytesasyncio.TimeoutError— thrown when the wait budget expires before the call returns; the underlying send is not interrupted and the thread keeps running to completion
Example:
async def exchange():
if await eoe_adv.send_frame_async(frame, timeout_ms=1000):
reply = await eoe_adv.receive_frame_async(timeout_ms=1000)
print(reply.hex() if reply is not None else "没有回帧") # No reply frame
receive_frame_async()
async def receive_frame_async(self,
timeout_ms: int = DEFAULT_TIMEOUT_MS
) -> Optional[bytes]
The asynchronous version of receive_frame_data(). The wait budget is timeout_ms more than 100 ms, leaving room for one send/receive round trip.
Parameters:
timeout_ms(int) — receive timeout (milliseconds), default 500
Returns / exceptions:
bytes | None— the frame that was received; returnsNonewhen no frame was obtained (no frame and a failed receive both appear asNoneand are not distinguished)asyncio.TimeoutError— thrown when the wait budget expires before the call returns
Example:
frame_in = await eoe_adv.receive_frame_async(timeout_ms=1000)
if frame_in is not None:
print(f"收到 {len(frame_in)} 字节") # Received {len(frame_in)} bytes
Ping tests (EoEAdvanced)
EoEAdvanced subclassping() / set_arp_entry() / clear_arp_cache() / the frame send/receive hooks live on EoEAdvanced (a subclass of the base EoE), not on the base slave.eoe interface. No public entry point returns an instance of this subclass (see the note at the top of the page); it is used only when you obtain the runtime instance and construct it yourself: EoEAdvanced(dll, master_index, slave_index). Ping in production code goes through EoEPinger(slave.eoe) below.
ping()
def ping(self, target_ip: str, timeout_ms: int = 5000,
ttl: int = 64) -> EoEPingResult
Sends an ICMP Echo Request through the EoE channel and waits for the response, returning an EoEPingResult result object (returned whether or not it succeeds; check the success field).
Parameters:
target_ip(str) — target IP address (dotted decimal, e.g."192.168.1.1")timeout_ms(int) — timeout (milliseconds), default 5000ttl(int) — IP TTL, default 64
Related structures:
@dataclass
class EoEPingResult:
success: bool = False # whether the ping succeeded
round_trip_time_ms: float = 0.0 # round-trip time (milliseconds)
target_address: str = "" # target address
ttl: int = 0 # time to live
error_message: str = "" # error message (on failure)
Example:
from darra_ethercat.slave.eoe import EoEAdvanced
eoe_adv = EoEAdvanced(dll, master.master_index, slave.slave_num)
result = eoe_adv.ping("192.168.1.1", timeout_ms=2000)
if result.success:
print(f"RTT={result.round_trip_time_ms:.2f}ms TTL={result.ttl}")
else:
print(f"Ping 失败: {result.error_message}") # Ping failed: {result.error_message}
Full example
Network configuration and Ping
import struct, socket
from darra_ethercat.slave.eoe import EoEAdvanced
if slave.eoe.is_supported is not False: # try for both True / None (unknown); skip only when SII confirms it is not declared
print(f"当前 IP: {slave.eoe.get_ip()}") # Current IP: {slave.eoe.get_ip()}
print(f"当前 MAC: {slave.eoe.get_mac()}") # Current MAC: {slave.eoe.get_mac()}
new_ip = struct.unpack('!I', socket.inet_aton('10.0.0.100'))[0]
new_subnet = struct.unpack('!I', socket.inet_aton('255.255.255.0'))[0]
new_gw = struct.unpack('!I', socket.inet_aton('10.0.0.1'))[0]
slave.eoe.set_ip(new_ip, new_subnet, new_gw)
slave.eoe.set_dns(struct.unpack('!I', socket.inet_aton('10.0.0.1'))[0])
# Ping goes through EoEAdvanced
eoe_adv = EoEAdvanced(dll, master.master_index, slave.slave_num)
ping = eoe_adv.ping("10.0.0.1")
if ping.success:
print(f"Ping 成功: {ping.round_trip_time_ms:.1f}ms") # Ping succeeded: {ping.round_trip_time_ms:.1f}ms
ARP cache management (EoEAdvanced)
set_arp_entry()
def set_arp_entry(self, ip: str, mac: bytes) -> None
Writes into the ARP cache of this instance (an IP→MAC mapping) so that ping() can look up the destination MAC when building frames. This is a Python-side frame-assembly cache; nothing is written to the slave.
Parameters:
ip(str) — IP address (e.g."192.168.1.1")mac(bytes) — MAC address (6 bytes)
clear_arp_cache()
def clear_arp_cache(self) -> None
Clears the ARP cache of this instance (Python side; nothing is sent to the slave).
Example:
from darra_ethercat.slave.eoe import EoEAdvanced
if slave.eoe.is_supported is not False: # try for both True / None (unknown); skip only when SII confirms it is not declared
eoe_adv = EoEAdvanced(dll, master.master_index, slave.slave_num)
# set a static ARP entry
eoe_adv.set_arp_entry("192.168.1.1",
bytes([0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF]))
# clear the ARP cache
eoe_adv.clear_arp_cache()
Asynchronous frame receive hook
EoEAdvanced.set_receive_hook() registers an EoE frame receive callback that the PDO main loop triggers directly when it receives an EoE Fragment Data frame, so there is no need to poll receive_frame_data().
set_receive_hook(callback)
def set_receive_hook(self, callback) -> bool
Registers the EoE asynchronous receive hook; every master shares the same receive callback, and a repeated call overwrites the previous registration.
Parameters:
callback(Callable) — callback signaturecallback(slave_index: int, frame: bytes) -> None
Returns:
bool— whether the hook was bound successfully (returnsFalsewhen the underlying library does not support receive hooks)
clear_receive_hook()
def clear_receive_hook(self) -> bool
Clears the EoE asynchronous receive hook.
Example:
from darra_ethercat.slave.eoe import EoEAdvanced
eoe_adv = EoEAdvanced(dll, master.master_index, slave.slave_num)
def on_frame(slave_index: int, frame: bytes):
print(f"[EoE] slave={slave_index} len={len(frame)}")
if eoe_adv.set_receive_hook(on_frame):
print("Hook 注册成功") # Hook registered
# ... the callback fires automatically for every PDO frame received within the EoE cycle ...
eoe_adv.clear_receive_hook()
The callback runs on the main loop thread of the underlying library, so it must stay very short (within tens of µs); otherwise it slows down the real-time PDO cycle. Enqueue only inside the callback and hand the real processing to a business thread.
EoEPinger (higher-level ICMP Ping utility)
EoEPinger wraps the base EoE (that is, slave.eoe), carries its own independent ARP cache, sends an ICMP Echo to the target IP and measures the round-trip time:
from darra_ethercat import EoEPinger
pinger = EoEPinger(slave.eoe, local_ip='192.168.100.1')
EoEPinger.ping()
def ping(self, target_ip: str, timeout_ms: int = 1000,
payload: bytes = b'DarraECat') -> Optional[float]
Sends an ICMP Echo and waits for the reply. On success it returns the round-trip time in milliseconds (float); on timeout or failure it returns None — not a result object, so there is no success field to check.
Parameters:
target_ip(str) — target IP, dotted decimal, e.g."192.168.1.1"timeout_ms(int) — timeout in milliseconds, default1000payload(bytes) — ICMP payload, defaultb'DarraECat'
Returns:
float | None— round-trip time in milliseconds; returnsNoneon timeout / send failure
Example:
rtt = pinger.ping("192.168.100.5", timeout_ms=1000)
print(f"RTT: {rtt:.2f} ms" if rtt is not None else "超时") # Timeout
EoEPinger.ping_async()
async def ping_async(self, target_ip: str, timeout_ms: int = 1000,
payload: bytes = b'DarraECat') -> Optional[float]
The asyncio version of ping(); the parameters and return value are identical.
update_arp_cache() / set_arp_entry() / clear_arp_cache()
def update_arp_cache(self, ip: str, mac: bytes) -> None
def set_arp_entry(self, ip: str, mac: bytes) -> None
def clear_arp_cache(self) -> None
Maintains the Pinger's own ARP cache (used only for frame assembly in this instance; nothing is written to the slave). update_arp_cache() and set_arp_entry() do the same thing: write one IP→MAC entry; a MAC that is not 6 bytes throws ValueError, and set_arp_entry() additionally validates that the IP is in four-part dotted format. clear_arp_cache() empties the entire cache. When the target IP is not in the cache, the frame is sent to the broadcast MAC, and the peer MAC is written into the cache automatically after a reply arrives.
| Category | Property | Type | Read/write | Description |
|---|---|---|---|---|
| ARP cache | arp_cache | dict[str, str] | read-only | Snapshot of the current cache; the key is the IP and the value is a string of the form AA:BB:CC:DD:EE:FF |
Example:
from darra_ethercat.slave.eoe import EoEPinger
pinger = EoEPinger(slave.eoe, local_ip='192.168.100.1')
pinger.update_arp_cache("192.168.100.5",
bytes([0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF]))
for ip, mac in pinger.arp_cache.items():
print(f"{ip} -> {mac}")
pinger.clear_arp_cache()
EoEPinger.set_arp_entry(ip, mac) and EoEAdvanced.set_arp_entry() share a name but have different scopes — the Pinger cache is used only for Ping, while the cache of an EoEAdvanced instance serves its own frame assembly. (The base EoE, that is slave.eoe, does not provide set_arp_entry; only EoEAdvanced has that method.)
Failures and handling
| Symptom | Cause | Handling |
|---|---|---|
| send_frame returns False | EoE communication is not established, or the whole frame exceeds 2016 bytes | Confirm the slave has reached a communicable state, trim the frame to 2016 bytes or less and resend |
| receive_frame keeps returning None | The peer sends no frame back, or the filter blocks the target MAC | Check the filters with get_address_filters first, then confirm the peer really replies |
| get_address_filters returns an empty list | No filter is configured on the slave; an empty list means no filtering | To receive only specific MACs, set the list with set_address_filters(); do not treat it as a read failure |
| ping returns None after waiting the full timeout | The target IP is unreachable, or its MAC is not in the ARP cache | Write the target MAC with update_arp_cache and retry once |
shutdown_eoe_async_executor()
from darra_ethercat.slave.eoe import shutdown_eoe_async_executor
def shutdown_eoe_async_executor(wait: bool = True) -> None
Shuts down the EoE asynchronous thread pool. Call it before the program exits to release the background threads.
Parameters:
wait(bool) — defaultTrue, waits for the tasks already submitted to the pool to finish before returning;Falsereturns immediately and the tasks keep running in the background to completion
Returns:
None
After shutdown the module no longer holds a thread pool, and the next call to any EoE *_async method creates one lazily again. Do not shut down while EoE asynchronous calls are still outstanding (especially with wait=False): those calls will outlive the exit path of the main program. If you have never used *_async, you do not need to call this function.
Example:
from darra_ethercat.slave.eoe import shutdown_eoe_async_executor
# After all EoE async calls have finished
shutdown_eoe_async_executor()