|
An IPv6-enabled UDP serverThis example shows a UDP server that starts up, fetches all interface addresses it can find, and binds a socket to each one of them. This includes any loopback addresses, as well as broadcast addresses, and the limited broadcast address 255.255.255.255. This way, when a datagram arrives, the server can find out exactly to which address it was sent.
Get the example here: udpserv.c. Compile with
An IPv6-enabled ``arp'' clientARP is used by IPv4 to resolve host IP addresses into hardware addresses. IPv6 does not use ARP, instead it uses ICMPv6 Neighbor Discovery. The following example is an ARP client, that supports both IPv4 and IPv6 (strictly speaking its not an ARP client if we are talking about IPv6, but a neighbor discovery client). What is boils down to is that you can use this program to query the network for the IP addresses of other machines, be it IPv4 or IPv6. The ARP client will first try to use Neighbor Discovery, and if it can't (i.e., the network is not IPv6 enabled), it will fall back to regular ARP. Here's some sample output from the program, querying an IPv4 enabled host 'tiger' for its address: tiger (192.168.0.1) is at 0:b0:d0:39:4d:a5 on eth0 [Ethernet 10/100MB] Here, the same output, but this time the host is IPv6 enabled: tiger (fe80::2b0:d0ff:fe39:4da5) is at 0:b0:d0:39:4d:a5 on eth0 [Ethernet 10/100MB]
Get the example here: arp6.c.
Compile with Contributing your examplesIf you want to contribute by writing an application that uses the
libpnet6 API, and post it here, contact me through the Contact page.
|
||||||||