coontie has asked for the wisdom of the Perl Monks concerning the following question:
However, what happens is that I get ALL of the data incoming EXCEPT that very last byte. The last byte is a squiggly } and I don't get it until much later. It's really strange. And then Amazon attempts to resend the message again. So, it ends up getting all screwed up. I have a feeling accepting raw TCP packets is not the right way, that I'm missing something inherent to HTTP. What am I doing wrong, can you please help? Thank you.#!/usr/bin/perl -w use IO::Socket; use strict; # Turn on autoflushing $| = 1; my $port = 54321; my $server = IO::Socket->new( Domain => PF_INET, Proto => 'tcp', LocalPort => $port, Listen => SOMAXCONN, Reuse => 1, ); die "Bind failed: $!\n" unless $server; my $new_sock = $server->accept(); while(<$new_sock>) { print $_ . "\n"; } close($server);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problems accepting HTTP packets from Amazon
by 7stud (Deacon) on Jun 22, 2011 at 19:34 UTC | |
by coontie (Sexton) on Jun 22, 2011 at 21:57 UTC | |
|
Re: problems accepting HTTP packets from Amazon
by 7stud (Deacon) on Jun 22, 2011 at 22:50 UTC | |
|
Re: problems accepting HTTP packets from Amazon
by Anonymous Monk on Jun 23, 2011 at 00:13 UTC |