in reply to How to check the UDP checksum of an IO::Socket::INET packet
I won't say it's impossible, but I don't *think* it can be done with IO::Socket::INET. The methods available will return peer address and port, but not specific fields in the IP or 'transport' (TCP / UDP) layer protocol.
It is certainly possible with something like Net::Pcap. But of course with that functionality comes complexity - you'll need to understand the structure of the entire frame / packet to get the right field and parse it into a meaningful number representing the checksum.
If you want to go that way for the receiver, you're looking at creating a simple packet capture ('sniffer') and there is an incredibly useful suite of Perl modules for crafting and dissecting frames / packets:
As BrowserUK says above, packets with incorrect checksums aren't even sent. There is of course the possibility it gets mangled en-route - perhaps that's what you're trying to check for? Although even then, as the receiver passes this up the stack and the checksum fails to verify, I think the packet is discarded before being sent to the 'application' layer.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to check the UDP checksum of an IO::Socket::INET packet
by dantheman1210 (Beadle) on Mar 14, 2012 at 17:13 UTC |