+ *
+ * Example:
+ * #include <sys/types.h>
+ * #include <sys/socket.h>
+ * #include <netdb.h>
+ *
+ * static void start_conn(int fd, char *msg)
+ * {
+ * printf("%s fd %i\n", msg, fd);
+ * close(fd);
+ * }
+ *
+ * // Set up a listening socket, return it.
+ * static struct io_listener *do_listen(const char *port)
+ * {
+ * struct addrinfo *addrinfo, hints;
+ * int fd, on = 1;
+ *
+ * memset(&hints, 0, sizeof(hints));
+ * hints.ai_family = AF_UNSPEC;
+ * hints.ai_socktype = SOCK_STREAM;
+ * hints.ai_flags = AI_PASSIVE;
+ * hints.ai_protocol = 0;
+ *
+ * if (getaddrinfo(NULL, port, &hints, &addrinfo) != 0)
+ * return NULL;
+ *
+ * fd = socket(addrinfo->ai_family, addrinfo->ai_socktype,
+ * addrinfo->ai_protocol);
+ * if (fd < 0)
+ * return NULL;
+ *
+ * freeaddrinfo(addrinfo);
+ * setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+ * if (bind(fd, addrinfo->ai_addr, addrinfo->ai_addrlen) != 0) {
+ * close(fd);
+ * return NULL;
+ * }
+ * if (listen(fd, 1) != 0) {
+ * close(fd);
+ * return NULL;
+ * }
+ * return io_new_listener(fd, start_conn, (char *)"Got one!");
+ * }