Perl recv Function
This function receives a message on SOCKET attempting to read LENGTH bytes, placing the data read into variable SCALAR.The FLAGS argument takes the same values as the recvfrom( ) system function, on which the function is based. When communicating with sockets, this provides a more reliable method of reading fixed-length data than the sysread function or the line-based operator <FH>.
Following is the simple syntax for this function:
recv SOCKET, SCALAR, LEN, FLAGS
This function returns in Scalar Context: undef on error or Number of bytes read.
Following is the example code showing its basic usage:
When above code is executed, it produced following result