diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-03-14 03:41:10 +0000 |
---|---|---|
committer | Charles Bailey <bailey@genetics.upenn.edu> | 1996-03-14 03:41:10 +0000 |
commit | 962dce220b1132007c2f8f257801f9d30dcd0c17 (patch) | |
tree | 35b66483e25103228caffeca1ec1ffa003b773d7 /t | |
parent | fa6b8193685efa8c20480d4f79f73cd7d797903f (diff) | |
download | perl-962dce220b1132007c2f8f257801f9d30dcd0c17.tar.gz |
Use $^O,and accomodate echo servers who drop connection immediately
Diffstat (limited to 't')
-rwxr-xr-x | t/lib/socket.t | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/t/lib/socket.t b/t/lib/socket.t index 14c7609741..afc2a5bb75 100755 --- a/t/lib/socket.t +++ b/t/lib/socket.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib' if -d '../lib'; require Config; import Config; if ($Config{'extensions'} !~ /\bSocket\b/ && - !(($Config{'osname'} eq 'VMS') && $Config{d_has_socket})) { + !(($^O eq 'VMS') && $Config{d_has_socket})) { print "1..0\n"; exit 0; } @@ -25,8 +25,8 @@ if (socket(T,PF_INET,SOCK_STREAM,6)) { inet_ntoa((unpack_sockaddr_in(getpeername(T)))[1]),"\n"; syswrite(T,"hello",5); - sysread(T,$buff,10); - print $buff eq "hello" ? "ok 3\n" : "not ok 3\n"; + $read = sysread(T,$buff,10); # Connection may be granted, then closed! + print(($read == 0 || $buff eq "hello") ? "ok 3\n" : "not ok 3\n"); } else { print "# You're allowed to fail tests 2 and 3 if.\n"; @@ -51,8 +51,8 @@ if( socket(S,PF_INET,SOCK_STREAM,6) ){ inet_ntoa((unpack_sockaddr_in(getpeername(S)))[1]),"\n"; syswrite(S,"olleh",5); - sysread(S,$buff,10); - print $buff eq "olleh" ? "ok 6\n" : "not ok 6\n"; + $read = sysread(S,$buff,10); # Connection may be granted, then closed! + print(($read == 0 || $buff eq "olleh") ? "ok 6\n" : "not ok 6\n"); } else { print "# You're allowed to fail tests 5 and 6 if.\n"; |