hi guys ,im new to perl programming and when i programmed tcp client-server coding in perl i encountered some problem saying :
Can't locate socket.pm in @INC (@INC contains: /usr/lib/perl5/5.8.5/i386-...)
i tried this in linux-centos and version of perl im using is: v5.8.5
my program was like this:
tcp-server:
#!/bin/perl -w
use strict;
use socket;qw(INADDR_ANY AF_INET SOCK_STREAM sockaddr_in);
my $proto=getprotobyname('tcp');
socket(SOMAXCONN,SOCK,AF_INET,SOCK_STREAM,$proto)or die "socket:$!";
my $port=getservbyname('daytime','tcp');
my $paddr=sockaddr_in($port,INADDR_ANY);
bind(SOCK,$paddr)or die "bind:$!";
listen(SOCK,SOMAXCONN)or die "listen:$!";
while(1)
{
if(accept(CLIENT,SOCK))
{
print CLIENT scalar localtime,"\n";
close CLIENT;
}
}
tcp-client:
#!/bin/perl -w
use strict;
use socket; qw(AF_INET SOCKSTREAM inet_aton sockaddr_in);
$proto=getprotobyname('tcp');
socket(SOCK,AF_INET,SOCK_STREAM,$proto)or die "socket:$!";
$addr=inet_aton('localhost');
$port=getservbyname('daytime','tcp');
$paddr=sockaddr_in($port,$addr);
connect(SOCK,$paddr)or die "connect:$!";
print <SOCK>;
close(SOCK)||die "close:$!";
when i ran server program ,i encountered that error.any help appreciated....