summaryrefslogtreecommitdiff
path: root/pod/perlfunc.pod
diff options
context:
space:
mode:
authorGisle Aas <gisle@activestate.com>2005-12-08 09:53:35 +0000
committerGisle Aas <gisle@activestate.com>2005-12-08 09:53:35 +0000
commit23d0437f66972bc146b114c26cbf448ceea3e9e2 (patch)
tree674f3add6323fa0ddfd67e2df53287b0683d98d8 /pod/perlfunc.pod
parent61ff64ea87bfc095e60d68654dc0c5199dec292f (diff)
downloadperl-23d0437f66972bc146b114c26cbf448ceea3e9e2.tar.gz
Improve the setsockopt description.
Removed claim that OPTVAL might be undef as it is just treated the same as 0 and give the usual use-of-uninitialized-value warning. Added an example. p4raw-id: //depot/perl@26299
Diffstat (limited to 'pod/perlfunc.pod')
-rw-r--r--pod/perlfunc.pod11
1 files changed, 9 insertions, 2 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 0127c820f5..2cb16d0149 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -4926,8 +4926,15 @@ that doesn't implement setpriority(2).
X<setsockopt>
Sets the socket option requested. Returns undefined if there is an
-error. OPTVAL may be specified as C<undef> if you don't want to pass an
-argument.
+error. Use integer constants provided by the C<Socket> module for
+LEVEL and OPNAME. Values for LEVEL can also be obtained from
+getprotobyname. OPTVAL might either be a packed string or an integer.
+An integer OPTVAL is shorthand for pack("i", OPTVAL).
+
+An example disabling the Nagle's algorithm for a socket:
+
+ use Socket qw(IPPROTO_TCP TCP_NODELAY);
+ setsockopt($socket, IPPROTO_TCP, TCP_NODELAY, 1);
=item shift ARRAY
X<shift>