Re: SOCK_RAW problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Giscard Wépiwé wrote:

> I write a small program in order to catch all packet
> at the physical layer (see below). I have the problem
> that i cannot see the contain of packet that i caugth.
> The printf() function returns the same Hex data.

>       printf("%x\n", (char *)buffer);

Of course it does; you're printing the address of the buffer, not its
contents. Please learn C before trying to write programs in it.

To print the contents:

	for (i = 0; i < recv_ret; i++)
		printf("%02x%s",
			((unsigned char *)buffer)[i],
			i%16 == 15 ? "\n" : " ");

-- 
Glynn Clements <glynn@sensei.co.uk>
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux