Perl send Function
This function sends a message on SOCKET (the opposite of recv). If the socket is unconnected, you must supply a destination to communicate to with the TO parameter. In this case, the sendto system function is used in place of the system send function.
The FLAGS parameter is formed from the bitwise or of 0 and one or more of the MSG_OOB and MSG_DONTROUTE options. MSG_OOB allows you to send out-of-band data on sockets that support this notion.
The underlying protocol must also support out-of-band data. Only SOCK_STREAM sockets created in the AF_INET address family support out-of-band data. The MSG_DONTROUTE option is turned on for the duration of the operation. Only diagnostic or routing programs use it.
Following is the simple syntax for this function −
send SOCKET, MSG, FLAGS, TO send SOCKET, MSG, FLAGS
This function returns undef on failure else Integer, number of bytes sent.
Following is the example code showing its basic usage −
When above code is executed, it produces the following result −