Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Compensate for bad inet checksum routine

by jwkrahn (Monsignor)
on Mar 29, 2013 at 17:35 UTC ( #1026178=note: print w/ replies, xml ) Need Help??


in reply to Compensate for bad inet checksum routine

sub prepchksum { my ( $payload ) = @_; ###DEBUG: printf "BEFORE = %s\n", unpack 'H*', $payload; if ( length( $payload ) % 2 == 1 ) { if ( substr( $payload, -1 ) ge "\x80" ) { substr $payload, -1, 1, chr ord( substr $payload, -1 ) - 1 +; substr $payload, -1, 0, "\xff"; } else { substr $payload, -1, 0, "\0"; } } ###DEBUG: printf "AFTER = %s\n", unpack 'H*', $payload; }


Comment on Re: Compensate for bad inet checksum routine
Download Code
Re^2: Compensate for bad inet checksum routine
by VinsWorldcom (Vicar) on Mar 29, 2013 at 18:12 UTC

    Beautiful! ++

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026178]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2015-07-06 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls