More testing of cv-branch required

Brian Ford Brian.Ford@flightsafety.com
Thu Jul 20 18:17:00 GMT 2006


On Tue, 11 Jul 2006, Corinna Vinschen wrote:

> Anyway, this needs a lot of testing and debugging.  Since the replies to
> my IPv6 mail on this list were so overwhelming and heart-warming, I
> thought I should try again and ask the people on this list for
> participation.  I hope it's not futile.

The attached STC demonstrates an EINPROGRESS error returned from a
non-blocking recvfrom call.  I believe the error should be EAGAIN as
mainline Cygwin returns.

I'm afraid my winsock skills are not sufficient to provide a patch at this
time.

-- 
Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained crew...
-------------- next part --------------
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>


int
main(void)
{
    int fd, i;

    fd = socket(AF_INET, SOCK_DGRAM, 0);
    if (fd < 0)
    {
	perror("socket");
	return -1;
    }

    {
        int flags = fcntl(fd, F_GETFL);

        if (flags < 0 || fcntl(fd, F_SETFL, flags|O_NONBLOCK) < 0)
        {
            perror("O_NONBLOCK");
            return -1;
        }
    }

    {
	struct sockaddr_in bind_addr;

	bind_addr.sin_family      = AF_INET;
	bind_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
	bind_addr.sin_port        = htons(8002);
	memset(&bind_addr.sin_zero, 0, sizeof(bind_addr.sin_zero));

	if (bind(fd, (struct sockaddr *)&bind_addr, sizeof(bind_addr)) < 0)
	{
	    perror("bind");
	    return -1;
	}
    }

    for (i = 1000; --i >= 0;)
    {
	char buf[1];

	if (recv(fd, buf, sizeof(buf), 0) < 0
	    && errno != EAGAIN)
	{
	    fprintf(stderr, "%d: ", i);
	    perror("recvfrom");
	    return -1;
	}
    }

    return 0;
}


More information about the Cygwin-developers mailing list