#!/usr/bin/perl -w use strict; use IO::Socket::INET; my $port = 12345; my $server = IO::Socket::INET->new( LocalAddr => '127.0.0.1', LocalPort => $port, Listen => 10, Reuse => 1, ) or die "failed to listen: $!"; my $client = $server->accept; my $cf = $client->fileno; open(STDIN, "<&$cf") || die "Couldn't dup client to stdin"; open(STDOUT, ">&$cf") || die "Couldn't dup client to stdout"; print "The client should see this message.\n"; close($client);