Raw socket behaviour

Oliver Friedrichs oliver@secnet.com
Wed Apr 30 16:32:00 GMT 1997

recv and recvfrom seem to exhibit a strange behavior when attempting to
receive from raw sockets.  An example of this is a raw ICMP socket.  The
code appears somewhat as follows (error checking removed for

int sockfd, size, len;
struct sockaddr_in sin;
u_char buf[1024];

sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
size=recvfrom(sockfd, buf, sizeof(buf), 0, (struct sockaddr *)&sin, &len);

recvfrom fails, with the error: Not owner

Now I can _write_ an ICMP packet without any problem at all, however can't
read them.  Am I missing something peculiar regarding cygwin32 ?  This is
being run as a user with administrator privileges (as mentioned, writing
works fine).

Also curious as to whether or not there will ever be select() support for
non-connected sockets?  select() on the ICMP socket doesn't work, so there
doesn't seem to be a way to time-out the recv() without using setjmp() and
alarm() (if the recv ever actually worked at all).

Thanks in advance,

- Oliver

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   Secure Networks Incorporated.  Calgary, Alberta, Canada, (403) 262-9211

For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

More information about the Cygwin mailing list