> getsockopt(i, SOL_SOCKET, SO_REUSEADDR, (caddr_t)&on, (int *) sizeof on); > printf("SO_REUSEADDR value is %d\n",on);
That code is broken. You are taking a constant and passing it to the system
to write to. The kernel doesnt want to do that and then you forget to check
the error.