This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

On WIN7, write() not returning immediately even on non-blocking sockets


Hi,
We have a proxy server type of program which has an infinite loop
writing to sockets with write() call.

All of the sockets are set to non-blocking mode.It works fine on linux
and all windows versions except win7(both 32 and 64 bit).We tested on
hundreds of computers.

The code where it gets stuck is

printf("Nonblocking:%d\n",(fcntl(t_qelem->respsock, F_GETFL, 0) &
O_NONBLOCK))?1:0;
i = write(t_qelem->respsock,&t_qelem->webtoresp[t_qelem->webtorespsent],t_qelem->webtoresplen-t_qelem->webtorespsent);
printf("written\n");

Output is :  Non-blocking:1 and then it does NOT print "written" ever.

I also tried to do some debugging using gdb.
write() -> send_internal()  ->{looping through fhandler_socket::wait_for_events}
even when the socket is set to blocking mode.

I am ignoring SIGPIPEs but I know that it probably happens only when
the connection has closed from the other side coz it happens when i
close the browser which is using this proxy software.Can you please
help me out, if i am doing something wrong.

Thanks
-- 
--
Regards
Pankaj Yadav

--
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]