R
Ralph
hi everyone,
i try to develop a test application on my smartphone (Windows Mobile 6
professional)
the application aims to receive mutlicast datagram,
i use windows raw socket :
if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)
{
//printf("WSAStartup() failed: %d\n", GetLastError());
return -1;
}
DWORD dwIoControlCode = SIO_RCVALL_MCAST;
DWORD dwProtocol = IPPROTO_UDP;
SOCKET s = WSASocket(PF_INET, SOCK_RAW, dwProtocol, NULL, 0,
WSA_FLAG_OVERLAPPED);
if (s == INVALID_SOCKET )
{
//printf("WSASocket() failed: %d\n", WSAGetLastError());
return -1;
}
SOCKADDR_IN if0;
if0.sin_family = AF_INET;
if0.sin_port = htons(0);
//192.0.63.36 is my ip adress
if0.sin_addr.s_addr = inet_addr("192.0.63.36");
if (bind(s, (SOCKADDR *)&if0, sizeof(if0)) == SOCKET_ERROR)
{
//printf("bind() failed: %d\n", WSAGetLastError());
return -1;
}
unsigned int optval = 1;
if (WSAIoctl(s, dwIoControlCode, &optval, sizeof(optval),
NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR)
{
/*printf("WSAIotcl(%d) failed; %d\n",
dwIoControlCode,WSAGetLastError());
return -1;
}
....
No error when build;
when application is running,
i get an error when application issues WSAIoctl, and the error code is 10022
(WSAEINVAL) according to msdn :
Invalid argument.
Some invalid argument was supplied (for example, specifying an invalid level
to the setsockopt function). In some instances, it also refers to the current
state of the socket—for instance, calling accept on a socket that is not
listening.)
The same code working fine in a standard win32 console application.
My question is :
the option SIO_RCVALL_MCAST is compatible with windows mobile6?
where is the problem else?
thank you for your help or any suggestion
regards
i try to develop a test application on my smartphone (Windows Mobile 6
professional)
the application aims to receive mutlicast datagram,
i use windows raw socket :
if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)
{
//printf("WSAStartup() failed: %d\n", GetLastError());
return -1;
}
DWORD dwIoControlCode = SIO_RCVALL_MCAST;
DWORD dwProtocol = IPPROTO_UDP;
SOCKET s = WSASocket(PF_INET, SOCK_RAW, dwProtocol, NULL, 0,
WSA_FLAG_OVERLAPPED);
if (s == INVALID_SOCKET )
{
//printf("WSASocket() failed: %d\n", WSAGetLastError());
return -1;
}
SOCKADDR_IN if0;
if0.sin_family = AF_INET;
if0.sin_port = htons(0);
//192.0.63.36 is my ip adress
if0.sin_addr.s_addr = inet_addr("192.0.63.36");
if (bind(s, (SOCKADDR *)&if0, sizeof(if0)) == SOCKET_ERROR)
{
//printf("bind() failed: %d\n", WSAGetLastError());
return -1;
}
unsigned int optval = 1;
if (WSAIoctl(s, dwIoControlCode, &optval, sizeof(optval),
NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR)
{
/*printf("WSAIotcl(%d) failed; %d\n",
dwIoControlCode,WSAGetLastError());
return -1;
}
....
No error when build;
when application is running,
i get an error when application issues WSAIoctl, and the error code is 10022
(WSAEINVAL) according to msdn :
Invalid argument.
Some invalid argument was supplied (for example, specifying an invalid level
to the setsockopt function). In some instances, it also refers to the current
state of the socket—for instance, calling accept on a socket that is not
listening.)
The same code working fine in a standard win32 console application.
My question is :
the option SIO_RCVALL_MCAST is compatible with windows mobile6?
where is the problem else?
thank you for your help or any suggestion
regards