[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);
####
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";
}