Fix bug in setsockopt call with SO_REUSEADDR

Optval wasn't set to a a known value. Set it to true (1), so that it always turns on SO_REUSEADDR.

There is no need to allocate memory for optval.