From: bala AT viman DOT com (Bala Parthasarathy) Subject: Select bug in beta 16? 15 Nov 1996 01:24:35 -0800 Sender: daemon AT cygnus DOT com Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199611150733.XAA19797.cygnus.gnu-win32@troilus.viman.com> Original-To: gnu-win32 AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com I'm using b16 of the gnu-win32 environment to port my Unix app to NT 3.51. One of my applications is a server, which uses UDP sockets for communications. I'm seeing the following problem with select in the server and it'll be great if anyone can shed some light on it. Thanks to the folks at Cygnus in doing a terrific job in making Unix->NT port smooth for the most part. The problem: Messages from clients to the server time out almost always. The cause: select() seems to be buggy: in particular, there seems to be some problem in the timeout. Consider the foll. code fragment: struct timeval time_out; time_out.tv_sec = 60; time_out.tv.usec = 0; retval = select(max_fd + 1, &read_mask, NULL, NULL, &time_out); This should return after 60 seconds or when a message arrives, whichever happens sooner, right? What actually happens is that the first time around, it only returns after 60 seconds. Even then it only tells you that it timed out even when there is a message. So our server breaks from a select after about 60 secs and thinks there are no messages even when there are. It then re-selects() and breaks almost immediately with the news that there is a message. Workaround: If I use very short timeout values (I tried 1 sec) and everything seems to be fine. The shorter the interval the more it approximates constantly polling all fd's. Presumably this could bring the system to its knees? Does anyone have any experience with using select and an earlier beta, like beta14 maybe? Bala - For help on using this list, send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".