# testchild.pl use IO::Socket; use Win32API::File; use Symbol qw(gensym); my $buf; my $handle = gensym(); my $handle1 = gensym(); Win32API::File::OsFHandleOpen($handle, $ARGV[0], "rw"); Win32API::File::OsFHandleOpen($handle1, $ARGV[1], "rw"); $handle1->close(); $handle = IO::Socket->new_from_fd($handle, "r+"); $handle->blocking(0); #while (defined (my $bytes_read = sysread($handle, $buf, 1024))) { while (defined (my $bytes_read = recv($handle, $buf, 1024, 0))) { if($bytes_read) { open FILE, ">> debug.txt"; print FILE $bytes_read, "\n"; print FILE $buf, "\n"; close FILE; } else { open FILE, ">> debug.txt"; print FILE "eof\n"; close FILE; exit 0; } } if( $! == 10035 ) { open FILE, ">> debug.txt"; print FILE "ewouldblock", "\n"; close FILE; } print syswrite($handle, "abcdef\n"), "\n"; exit 0;