delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/04/30/19:55:57

From: oliver AT secnet DOT com (Oliver Friedrichs)
Subject: Raw socket behaviour
30 Apr 1997 19:55:57 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <Pine.BSI.3.95.970430171452.5676A-100000.cygnus.gnu-win32@silence.secnet.com>
Mime-Version: 1.0
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

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
simplification).

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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019