in reply to Re: Win32 fork using open3
in thread Win32 fork using open3

i'm sorry i can't look closely at your code now, but after a quick browse i noticed you aren't checking the return codes from sysread and syswrite -- you should.

~Particle *accelerates*

Replies are listed 'Best First'.
Re^3: Win32 fork using open3
by NaSe77 (Monk) on Jun 19, 2002 at 12:22 UTC
    that is right and a good idea ... did u have something like
    my $read_bytes = sysread $hand, $buf, $num_bytes; die "error occured reading from socket : $!\n" unless ($read_bytes && ($read_bytes == $num_bytes));
    and the same for the writing in mind ?

    ----
    NaSe
    :x

      not exactly. from the sysread doc:

      Returns the number of bytes actually read, 0 at end of file, or undef if there was an error.
      this is the full logic, but it can be condensed to fit your needs.

      if( defined $read_bytes ) { if( $read_bytes >= 0 ) { print 'read something'; if( $read_bytes == $num_bytes ) { print 'read full buffer'; } elsif( $read_bytes < $num_bytes ) { print 'buffer length: ', $num_bytes, ' read length: ', $read_by +tes; } else { die 'how did i get here?'; } } elsif( $read_bytes == 0 ) { print 'EOF'; } else { die 'how did i get here?'; } } else { die 'error reading socket'; }

      ~Particle *accelerates*