Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Feb 2004 10:14:16 +1100 (EST)
From:      Andrew <andrew@ugh.net.au>
To:        freebsd-hackers@freebsd.org
Subject:   select, sendto and ENOBUFS
Message-ID:  <20040210100257.G56192-100000@starbug.ugh.net.au>

next in thread | raw e-mail | index | archive | help
Hi,

I have a problem with sendto returning an error and setting errno to
ENOBUFS however I am calling select first to make sure the fd is
writeable (see below for code). s is a raw socket and the data I'm
sending is 1492 bytes. I haven't changed the low water mark for the
socket.

This looks like a bug however the bug may well be mine...

Does anyone have any ideas?

Thanks,

Andrew

do {
    printf("waiting on socket\n");
    FD_ZERO(&fdset);
    FD_SET(s, &fdset);
    if (select(s + 1, NULL, &fdset, NULL, NULL) == -1) {
        warn("select");
        return 0;
    }
} while (! FD_ISSET(s, &fdset));
printf("socket ready\n");

if (se$ndto(s, (void *)ip_packet, ip_packet->ip_len, 0, (struct sockaddr
*)&sa, sizeof(sa)) == -1) {
    if (errno == ENOBUFS) {
        warn("sleeping 1 second - sendto");
        sleep(1);
    } else {
        warn("sendto");
    }
    return 0;
}




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040210100257.G56192-100000>