rem: int ret, sock, timeout = ncsock->timeout;
add: int ret, sock, sockopt = 1, timeout = ncsock->timeout;
context: static int core_udp_listen(nc_sock_t *ncsock){  int ret, sock, timeout = ncsock->timeout;  struct sockaddr_in myaddr;  struct timeval tt;		/* needed by the select() call */  debug_v("core_udp_listen(ncsock=%p)", (void *)ncsock);  sock = netcat_socket_new(PF_INET, SOCK_DGRAM);  if (sock < 0)    return -1;  /* prepare myaddr for the bind() call */  myaddr.sin_family = AF_INET;  myaddr.sin_port = htons(ncsock->local_port.num);  memcpy(&myaddr.sin_addr, &ncsock->local_host.iaddrs[0], sizeof(myaddr.sin_addr));  /* only call bind if it really needed -- most of the cases in this function */  if (myaddr.sin_port || myaddr.sin_addr.s_addr) {    ret = bind(sock, (struct sockaddr *)&myaddr, sizeof(myaddr));    if (ret < 0)      goto err;  }  /* since this protocol is connectionless, we need a special handling here.     We want to simulate a two-ends connection but in order to do this we need     a remote address.  Wait here until a packet is received, and use its     source address as default remote address.  If we have the zero-I/O option     we just eat the packet and will never return (if a timeout is not set) */  tt.tv_usec = 0;  tt.tv_sec = timeout;  while (TRUE) {    fd_set ins;    FD_ZERO(&ins);    FD_SET(sock, &ins);    select(sock + 1, &ins, NULL, NULL, (timeout > 0 ? &tt : NULL));    if (FD_ISSET(sock, &ins)) {      int recv_ret, write_ret;      char buf[1024];      struct sockaddr_in rem_addr;      int addr_len = sizeof(rem_addr);      /* now check the remote address.  If we are simulating a routing then         use the MSG_PEEK flag, which leaves the received packet untouched */      recv_ret = recvfrom(sock, buf, sizeof(buf), (opt_zero ? 0 : MSG_PEEK),		     (struct sockaddr *)&rem_addr, &addr_len);      debug_v("received packet from %s:%d%s", netcat_inet_ntop(&rem_addr.sin_addr),		ntohs(rem_addr.sin_port), (opt_zero ? "" : ", using as default dest"));      if (opt_zero) {	/* FIXME: why don't allow -z with -L? but only for udp! (?) */	write_ret = write(STDOUT_FILENO, buf, recv_ret);	bytes_recv += write_ret;	debug_dv("write_u(stdout) = %d", write_ret);	if (write_ret < 0) {	  perror("write_u(stdout)");	  exit(EXIT_FAILURE);	}	/* FIXME: handle write_ret != read_ret */	/* if the hexdump option is set, hexdump the received data */	if (opt_hexdump) {#ifndef USE_OLD_HEXDUMP	  fprintf(output_fd, "Received %d bytes from %s:%d\n", recv_ret,		netcat_inet_ntop(&rem_addr.sin_addr), ntohs(rem_addr.sin_port));#endif	  netcat_fhexdump(output_fd, '<', buf, write_ret);	}      }      else {	connect(sock, (struct sockaddr *)&rem_addr, addr_len);        /* this is all we want from this function */        return sock;      }    }    else			/* select() timed out! */      break;  }				/* end of packet receiving loop */  /* no packets until timeout, set errno and proceed to general error handling */  errno = ETIMEDOUT; err:  close(sock);  return -1;}				/* end of core_udp_listen() */