my $read_bytes = sysread $hand, $buf, $num_bytes; die "error occured reading from socket : $!\n" unless ($read_bytes && ($read_bytes == $num_bytes));