5 @INC = '../lib' if -d '../lib';
6 require Config; import Config;
7 if ($Config{'extensions'} !~ /\bSocket\b/ &&
8 !(($^O eq 'VMS') && $Config{d_has_socket})) {
18 if (socket(T,PF_INET,SOCK_STREAM,6)) {
21 if (connect(T,pack_sockaddr_in(7,inet_aton("localhost")))){
24 print "# Connected to ",
25 inet_ntoa((unpack_sockaddr_in(getpeername(T)))[1]),"\n";
27 syswrite(T,"hello",5);
28 $read = sysread(T,$buff,10); # Connection may be granted, then closed!
29 print(($read == 0 || $buff eq "hello") ? "ok 3\n" : "not ok 3\n");
32 print "# You're allowed to fail tests 2 and 3 if.\n";
33 print "# The echo service has been disabled.\n";
44 if( socket(S,PF_INET,SOCK_STREAM,6) ){
47 if (connect(S,pack_sockaddr_in(7,INADDR_LOOPBACK))){
50 print "# Connected to ",
51 inet_ntoa((unpack_sockaddr_in(getpeername(S)))[1]),"\n";
53 syswrite(S,"olleh",5);
54 $read = sysread(S,$buff,10); # Connection may be granted, then closed!
55 print(($read == 0 || $buff eq "olleh") ? "ok 6\n" : "not ok 6\n");
58 print "# You're allowed to fail tests 5 and 6 if.\n";
59 print "# The echo service has been disabled.\n";