I need to use raw sockets in Windows CE 5.0. The following code always fails with error
socket fai开发者_运维知识库led, err:10044.
WSAData wsaData;
SOCKET s;
int n;
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());
}
}
What must I do for using raw sockets in Windows CE?
I find MSDN documentations for WinCE specific sockets are rather few, but the guide for desktop winsock is pretty nice.
I stumbled upon the following links when trying to write my very first socket app for WinCE 5.0:
- Porting Socket Applications to Winsock
- Porting Raw Socket to Winsock
- Determining if Raw Sockets are supported
I hope you find them useful.
Note that even though the above articles are for desktop, I can use the concepts and codes with few modifications.
Raw IP sockets are not supported in Windows CE 5.0. You can use NDISUIO to send packets with arbitrary content.
加载中,请稍侯......
精彩评论