Hi, I've been testing the effects of the SO_RCVBUF/SO_SNDBUF socket options on unix sockets on various platforms, and I've run into some curious unix socket behavior on Cygwin (independent of the SO_RCVBUF/SO_SNDBUF options).
This piece of code should get blocked in one of the writes (and it does so for regular pipes): #include <sys/socket.h> #include <stdio.h> #include <unistd.h> int main() { int p[2]; socketpair(AF_LOCAL, SOCK_STREAM, 0,p); /*pipe(p);*/ /*setsockopt(p[0], SOL_SOCKET, SO_RCVBUF, &(int){1},sizeof(int));*/ /*setsockopt(p[0], SOL_SOCKET, SO_SNDBUF, &(int){1},sizeof(int));*/ /*setsockopt(p[1], SOL_SOCKET, SO_RCVBUF, &(int){1},sizeof(int));*/ /*setsockopt(p[1], SOL_SOCKET, SO_SNDBUF, &(int){1},sizeof(int));*/ ssize_t n; for(unsigned j=0;j<10000;j++) for(unsigned char i=1; i!=0; i++){ printf("%u\n", j*256+i); if(0>(n=write(p[1],&i,1))) perror("write"); } } but with a unix socket socket pair a first couple of writes proceed quickly and then the writes continue to proceed with ever-increasing intervals between them. I don't see why it should behave like this and I think you guys might want to look into why it does. Best regards, Petr Skocik -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple