Posted on 1997-05-14
I am currently trying to implement my first client server
application. I am using Perl 5.002 to do so. I noticed
that in the Camel Book pg.350 under the section about
sockets, they give an example of a multi-threaded server.
In that example the following statment is found:
setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack("1", 1))
or die "setsockopt: $!";
But when I looked up the definition of setsockopt in the
aphabetical listing of all Perl functions (on pg.214) it says:
setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, 1)
or warn "Can't do setsockopt: $!\n";
My question is why would you use pack to set the value of OPTVAL
in the first example?
Any help would be greatly appreciated!