# ----------------------------------------------------------------- # Perl network programming notes # ------------------------------ # Reading can be done with: # 1) <$sock> - blocks till new line # 2) read($sock, $buf, $len) - blocks till $len bytes received # (like W Richard Stevens readn function in C) # 3) sysread($sock, $buf, $len) - may return less than asked for # (like read()/recv() in C) # ------------------------------------------------------- ... # This one blocks until newline received. # $data = <$client>; # This one blocks till $len bytes received (like Stevens readn function in C) # my $hdr; # my $hdrlen = read( $client, $hdr, $SYSLOG_HDR_LEN ); # This one may return less than asked for (like read()/recv() in C) my $msglen = sysread( $client, $data, $SYSLOG_MAX_MSG_LEN );