Answered by:
Raw sockets in Windows CE 5.0?

Question
-
What must I do to use raw sockets in Windows?
CE 5.0? The following code always fails with the error:
socket failed, err:10044 (The support for the specified socket type does not exist in this address family. )
WSAData wsaData; int n; SOCKET s; n = WSAStartup(MAKEWORD(2,0), &wsaData); if (n < 0) { printf("WSAStartUp failed, err:%d\n", WSAGetLastError()); } else { s = socket(AF_INET, SOCK_RAW, IPPROTO_IP); if (s < 0) { printf("socket failed, err:%d\n", WSAGetLastError()); } }
Wednesday, June 8, 2011 8:02 AM
Answers
-
Windows CE 5.0 supports raw sockets (for IRCOMM). But there is no support for raw socket sockets in the AF_INET family. So IPPROTO_RAW is useless.
But you can use the NDISUIO module to mimick raw sockets. The NDISUIO API provides facilities to send packets with arbitrary content and receive anything on a Ethernet adapter. So you get the same as you would get with raw sockets, but you must change the code to use the network adapter.
Helge
Thursday, July 21, 2011 12:53 PM
All replies
-
It looks like you cannot create a raw socket specifying IPPROTO_IP: try with IPPROTO_RAW which, in winsock.h is #define'd as:
#define IPPROTO_RAW 255 /* raw IP packet */
Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.comWednesday, June 8, 2011 11:53 AM -
Thanks for reply.
Passing the arguments (AF_INET, SOCK_RAW, IPPROTO_RAW) e.g. (2,3,255) to the socket() function gives the same return value SOCKET_ERROR with LastError 10044. The same appears for any value from 0x0 to 0xFFF as the third parameter value.
Wednesday, June 8, 2011 12:04 PM -
Windows CE 5.0 supports raw sockets (for IRCOMM). But there is no support for raw socket sockets in the AF_INET family. So IPPROTO_RAW is useless.
But you can use the NDISUIO module to mimick raw sockets. The NDISUIO API provides facilities to send packets with arbitrary content and receive anything on a Ethernet adapter. So you get the same as you would get with raw sockets, but you must change the code to use the network adapter.
Helge
Thursday, July 21, 2011 12:53 PM