#!/usr/bin/perl -w use strict; use warnings; use IO::Socket::INET; my $socket = IO::Socket::INET->new ( PeerHost => "X.X.X.X", PeerPort => "9000", LocalHost => "Y.Y.Y.Y", LocalPort => "9001", Listen => SOMAXCONN, Reuse => 1 ) or die "Can't connect to socket: $!\n"; while (my $client = $socket->accept) { my $pid = fork(); if ($client->peerhost() = X.X.X.X) if ($pid == 0) { handle_client($client) } ... }