December 2000
Intermediate to advanced
784 pages
20h 54m
English
Remember the send() and recv() calls from Chapter 4 (Other Socket-Related Functions)? We are now going to use them for the first time.
You can send a single byte of TCP urgent data over a connected socket by calling send() with the MSG_OOB flag:
send ($socket,'a',MSG_OOB) or die "Can't send(): $!";
In this code fragment, we call send() to transmit the character "a" across the socket $socket. The MSG_OOB flag specifies that the message is urgent and must be delivered right away. On the other end, the recipient of the message can read the urgent data by calling recv() with the same flag:
recv ($socket,$data,1,MSG_OOB) or die "Can't recv(): $!";
Here we're asking recv() to fetch 1 byte of urgent data ...
Read now
Unlock full access