Perl Programming Documentation
Download Perl
Explore

Manual

- Overview
- Tutorials
- FAQs
- History / Changes
- License

Reference

- Language
- Functions
- Operators
- Special Variables
- Pragmas
- Utilities
- Internals
- Platform Specific

Modules

- A • B • C • D • E
- F • G • H • I • L
- M • N • O • P • S
- T • U • X

Tools

- Preferences

# setsockopt

Perl 5 version 18.2 documentation
Go to top
Show recent pages
Recently read

# setsockopt

Perl functions A-Z | Perl functions by category | The 'perlfunc' manpage

- setsockopt SOCKET,LEVEL,OPTNAME,OPTVAL

  Sets the socket option requested. Returns `undef` on error. Use integer constants provided by the `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 Nagle's algorithm on a socket:

          use Socket qw(IPPROTO_TCP TCP_NODELAY);    setsockopt($socket, IPPROTO_TCP, TCP_NODELAY, 1);

  Portability issues: setsockopt in perlport.