use POSIX; use IO::Socket; use IO::Select; use Socket; use Fcntl; use Tie::RefHash; $port = N; # change this at will # Listen to port. #$server = IO::Socket::INET->new(LocalPort => $port, # Listen => 10 ) # or die "Can't make server socket: $@\n"; unlink "/tmp/mysock"; $server = IO::Socket::UNIX->new(Local => "/tmp/mysock", Type => SOCK_STREAM, Listen => 5 ) or die "Failed to make socket: $!"; #### use IO::Socket; #$socket = IO::Socket::INET->new(PeerAddr => "x.x.x.x", # PeerPort => "N", # Proto => "tcp", # Type => SOCK_STREAM) # or die "Couldn't connect to x.x.x.x :N : $@\n"; $socket = IO::Socket::UNIX->new(PeerAddr => "/tmp/mysock", Type => SOCK_STREAM, Timeout => 10 ) or die $@;