Приглашаем посетить
Экономика (economics.niv.ru)

[Chapter 3] 3.2.142 setsockopt

PreviousChapter 3
Functions
Next
 

3.2.142 setsockopt

setsockopt SOCKET, LEVEL, OPTNAME, OPTVAL

This function sets the socket option requested. The function returns undefined if there is an error. OPTVAL may be specified as undef if you don't want to pass an argument. A common option to set on a socket is SO_REUSEADDR, to get around the problem of not being able to bind to a particular address while the previous TCP connection on that port is still making up its mind to shut down. That would look like this:

use Socket;
...
setsockopt(MYSOCK, SOL_SOCKET, SO_REUSEADDR, 1)
        or warn "Can't do setsockopt: $!\n";


PreviousHomeNext
3.2.141 setpriorityBook Index3.2.143 shift