Isn't our behaviour wrong... On 6-current, the program below prints: connect: Connection refused Shouldn't it print: connect: Operation now in progress Hint: it does on Linux. -jr ------ #include <unistd.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <fcntl.h> main() { int s; int f; struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(54321); /* port with nothing on it */ addr.sin_addr.s_addr = inet_addr("127.0.0.1"); s = socket(PF_INET, SOCK_STREAM, 0); if (s < 0) { perror("socket"); exit(1); } f = fcntl(s, F_GETFL, 0); if (f < 0) { perror("fcntl F_GETFL"); exit(1); } f |= O_NONBLOCK; if (fcntl(s, F_SETFL, f) < 0) { perror("fcntl F_SETFL"); exit(1); } if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("connect"); exit(1); } exit(0); }Received on Fri May 06 2005 - 00:34:45 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:34 UTC