Replies: 3 comments 9 replies
-
This is the entire code: #include <SPI.h> // Set the MAC address of your Ethernet shield. // Define the relay pins EthernetUDP udp; // Create an instance of EthernetUDP void setup() { // Initialize the relays to an initial state (off) // Initialize the Ethernet shield udp.begin(9); // Start UDP on arbitrary port (9 in this case) void loop() { // Send a Gratuitous ARP } void sendGratuitousARP() { // Send the packet via UDP to the local IP |
Beta Was this translation helpful? Give feedback.
-
I see a problem. The ARP entries never expire now, because the uip_arp_timer() which does the cleanup is never called. I fix it. |
Beta Was this translation helpful? Give feedback.
-
a week is good. I didn't have a better result and I could not find out what is the problem.. |
Beta Was this translation helpful? Give feedback.
-
I'm looking for a way to maintain the ARP table on the router, it now times out after a while. The only solution now is to add a manual ARP entry to the ARP table of the router, but this is unwanted.
I now have this, but it seems to hang somewhere if I add this to my code:
// Send a Gratuitous ARP
sendGratuitousARP();
}
void sendGratuitousARP() {
// Construct a Gratuitous ARP packet manually
uint8_t arpPacket[42] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // Ethernet destination MAC (broadcast)
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], // Ethernet source MAC
0x08, 0x06, // ARP type (0x0806)
0x00, 0x01, // Hardware type (Ethernet)
0x08, 0x00, // Protocol type (IPv4)
0x06, // Hardware address length
0x04, // Protocol address length
0x00, 0x01, // ARP request operation
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], // Sender hardware address (MAC)
192, 168, 1, 100, // Sender protocol address (IP)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Target hardware address (zero-filled)
192, 168, 1, 100 // Target protocol address (IP)
};
// Send the packet via UDP to the local IP
udp.beginPacket(Ethernet.localIP(), 9); // Send to self on port 9 (arbitrary)
udp.write(arpPacket, sizeof(arpPacket));
udp.endPacket();
}
Beta Was this translation helpful? Give feedback.
All reactions