This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Raw Socket support using Cygwin.


> To: "Prabhune, Abhijeet" <APrabhun at ciena dot com>,<cygwin at cygwin dot
com> 
> Subject: RE: Raw Socket support using Cygwin. 
> From: "Robert Collins" <robert dot collins at itdomain dot com dot au> 
> Date: Fri, 23 Mar 2001 12:08:43 +1100 
> Thread-Index: AcCzNLmWb6XCK3qBQfygxAw1UqdU1wAAJXhw 
> Thread-Topic: Raw Socket support using Cygwin. 
 
>> -----Original Message-----
>> From: Prabhune, Abhijeet [mailto:APrabhun@ciena.com]
>> Sent: Friday, March 23, 2001 12:07 PM
>> To: 'cygwin-apps@cygwin.com'
>> Cc: 'cygwin-developers@cygwin.com'
>> Subject: Raw Socket support using Cygwin.
>>
>>
>> Hi,
>> I am developing a program which requires Raw Ip Sockets on 
>> Windows NT 4.0
>> I know that Winsock2 provided by Microsoft does not provide 
>> this support.


Not quite true. Under NT, both winsock1 and winsock2 do support RAW SOCKETS,
but only to administrators.

The executable from this code (extract from a ping programme) produces error=0
when run by administrator, but error code 10013 (WSAEACCES) when run by
non-admin:

#include <winsock.h>
#include <stdio.h>

SOCKET icmp_open(void) {
  SOCKET s = socket (AF_INET, SOCK_RAW , IPPROTO_ICMP);
  printf("socket(type=SOCK_RAW, protocol=IPROTO_ICMP), Error code: %d \n", 
WSAGetLastError());		
  if (s == SOCKET_ERROR) {
    return (INVALID_SOCKET);
  }
  return (s);
} 

int main(){
  WSADATA wsaData;
  SOCKET a;
  if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0)
     return 255;
  a=icmp_open();
    WSACleanup();
    return 0;
}

Danny

_____________________________________________________________________________
http://calendar.yahoo.com.au - Yahoo! Calendar
- Access your appointments and meetings online.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]