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

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

Replies are listed 'Best First'.
Re^4: Win32 fork using open3
by particle (Vicar) on Jun 19, 2002 at 12:45 UTC
    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*