I am trying to teach myself network programming in perl and i am at the early stages, one of the first ports that i am trying to connect to on a server is port 13, this port is suppost to provide you with 'daytime' information (basically the time), problem is every server that i try to connect to has the port closed (for various security reasons i think).
i am running activeperl 5.8 on windows xp pro, the error i get is always on the 'connect()' function, that being, it cant connect. i would appreciate it if anyone who new of a daytime service still running could try this script out for me, thanx in advance
here is the script:
#!/perl/bin/perl
use strict;
use Socket;
use constant DEFAULT_ADDR => '127.0.0.1';
use constant PORT => 13;
use constant IPPROTO_TCP => 6;
my $address = shift || DEFAULT_ADDR;
my $packed_addr = inet_aton($address);
my $destination = sockaddr_in(PORT,$packed_addr);
socket(SOCK,PF_INET,SOCK_STREAM,IPPROTO_TCP) or die "Can't make socket: $!";
connect(SOCK,$destination) or die "Can't connect: $!";
print <SOCK>;
i am running activeperl 5.8 on windows xp pro, the error i get is always on the 'connect()' function, that being, it cant connect. i would appreciate it if anyone who new of a daytime service still running could try this script out for me, thanx in advance
here is the script:
#!/perl/bin/perl
use strict;
use Socket;
use constant DEFAULT_ADDR => '127.0.0.1';
use constant PORT => 13;
use constant IPPROTO_TCP => 6;
my $address = shift || DEFAULT_ADDR;
my $packed_addr = inet_aton($address);
my $destination = sockaddr_in(PORT,$packed_addr);
socket(SOCK,PF_INET,SOCK_STREAM,IPPROTO_TCP) or die "Can't make socket: $!";
connect(SOCK,$destination) or die "Can't connect: $!";
print <SOCK>;