On Sun, Feb 29, 2004 at 06:54:25PM -0800, Ken Herron wrote: > --On Sunday, February 29, 2004 08:56:42 PM -0500 Mike Simons > <[EMAIL PROTECTED]> wrote: > > >- Anyone have a place to look in the RFCs or such that would explain > > why it's waiting, for what? > > Seems pretty quick to me:
That's because I messed up the code pasted into the original message. I was adding the before/after setsockopt thing as a last minute change to the code, please try this version instead. :) === #include <arpa/inet.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <sys/socket.h> #include <sys/types.h> #include <string.h> #include <stdio.h> #include <unistd.h> #define BEFORE_ACCEPT 0 int main(int argc, char *argv[]) { int accept_sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); int option = 1; int file; socklen_t accept_addr_len; struct sockaddr_in accept_addr; char buffer[1<<16]; memset(&accept_addr, 0, sizeof(accept_addr)); accept_addr.sin_family = AF_INET; accept_addr.sin_port = htons(2222); inet_aton("0.0.0.0", &accept_addr.sin_addr); setsockopt(accept_sock, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); bind(accept_sock, (struct sockaddr *) &accept_addr, sizeof(accept_addr)); listen(accept_sock, 128); #if BEFORE_ACCEPT if (!(argc == 2 && sscanf(argv[1], "%d", &option))) option = 1024; setsockopt(accept_sock, SOL_SOCKET, SO_RCVBUF, &option, sizeof(option)); #endif accept_addr_len = sizeof(accept_addr); file = accept(accept_sock, (struct sockaddr *) &accept_addr, &accept_addr_len); #if !BEFORE_ACCEPT if (!(argc == 2 && sscanf(argv[1], "%d", &option))) option = 1024; setsockopt(file, SOL_SOCKET, SO_RCVBUF, &option, sizeof(option)); #endif while (read(file, &buffer, sizeof(buffer))); return 0; } === _______________________________________________ vox-tech mailing list [EMAIL PROTECTED] http://lists.lugod.org/mailman/listinfo/vox-tech