Sending ARP packet, detecting network

1 reply [Last post]
zidaane
Offline
Joined: 05/01/2010

The problem I'm working on involves detecting when the router is available.
For reasons I won't get into this is the only way to determine the link is really up
as it's between some mini-hubs that keep the local link up even though the router on the other side is gone. I was planning on ARP'ing the gateway.

So, I need an example of sending an ARP packet through the interface.

Mark Bednarczyk
Mark Bednarczyk's picture
Offline
Joined: 03/22/2008
The sendPacket example is a

The sendPacket example is a good start. The easiest way to create a new packet is to capture one ARP packet and use it as a template for your new packet. You can either modify the template packet directly in JBuffer memory, or you can dump the template packet as a hexdump (ie.. packet.toHexdump()), and copy the packet contents as a string into the contructor of a new JMemoryPacket. You can use existing ethernet and ARP setters to change any of the fields or do it manually in the hexdump string or buffer.

Sly Technologies, Inc.
R&D

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.