#include <netinet/in.h>
#include <sys/epoll.h>
#include <sys/ioctl.h>
+#include <errno.h>
unsigned short port = 2007;
sin.sin_addr = destinations[dst_num];
// non-blocking connect (will be detected by epoll later)
- if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
+ if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) == -1 && errno != EINPROGRESS) {
perror("connect()");
exit(1);
}