ghopwood has asked for the wisdom of the Perl Monks concerning the following question:
Using the netcat command,[01]Title[02][1C]payload[03]number[04] [01] = ASCII SOH [02] = ASCII STX [1C] = ASCII FS [03] = ASCII ETX [04] = ASCII EOT
use strict; use IO::Socket; my $sock = new IO::Socket::INET ( LocalPort => '2000', Proto => 'tcp', Listen => 5, Reuse => 1, ); die "Could not create socket: $!\n" unless $sock; my $new_sock = $sock->accept(); while(<$new_sock>) { print $_; } close($sock);
Neither of these examples ever 'detect' or 'see' something on the socket to read.use strict; use POE qw(Component::Server::TCP); POE::Component::Server::TCP->new( Port => 2000, ClientInput => \&event_tcp_incoming, ); sub event_tcp_incoming { my ($heap, $kernel, $input) = @_[HEAP, KERNEL, ARG0]; print "Received: $input\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TCP Socket not receiving.
by BrowserUk (Patriarch) on Jul 24, 2012 at 15:52 UTC | |
by ghopwood (Initiate) on Jul 24, 2012 at 16:48 UTC | |
|
Re: TCP Socket not receiving.
by zwon (Abbot) on Jul 24, 2012 at 15:47 UTC |