-
November 13th, 2013, 05:41 PM
#1
How to detect the multicast group address?
I have a problem with UDP Multicast. I managed to send UDP Multicast telegrams and receive them. But when I receive the telegram I need to find out to which multicast group address it was sent. So far I have:
Code:
recvfrom( hSocket,
pcData,
nMaxDataLen,
0,
(SOCKADDR*) &from,
&len);
When I read from.sin_addr.S_un.S_addr; then I get the original IP Adresse from the sender PC but I also would like to know to which group address it was sent. Is there a way to get this infoamtion?
-
November 14th, 2013, 11:16 AM
#2
Re: How to detect the multicast group address?
1) it is "datagram" not "telegram"
2) As far as I know, the receiver can't know what the sender used to do the multicast, so if this is critical information, you need to make this part of your protocol.
-
November 15th, 2013, 04:21 AM
#3
Re: How to detect the multicast group address?
I can't make it part of my protocol because it's a 3rd party software from where I receive the datagram. I have read through the internet and sometime I found in some forums the function WSARecvMsg where some people say that I could get these information from if I would use this:
Code:
int nEnable = 1;
setsockopt(hTmpSocket, IPPROTO_IP, IP_PKTINFO, (char FAR*)&nEnable, sizeof(nEnable));
But my compiler (VS2010) says the function WSARecvMsg is unknown even though I included Mswsock.h
-
November 15th, 2013, 04:42 AM
#4
Re: How to detect the multicast group address?
Originally Posted by grka
...
But my compiler (VS2010) says the function WSARecvMsg is unknown even though I included Mswsock.h
From MSDN article WSARecvMsg:
Note The function pointer for the WSARecvMsg function must be obtained at run time by making a call to the WSAIoctl function with the SIO_GET_EXTENSION_FUNCTION_POINTER opcode specified. The input buffer passed to the WSAIoctl function must contain WSAID_WSARECVMSG, a globally unique identifier (GUID) whose value identifies the WSARecvMsg extension function. On success, the output returned by the WSAIoctl function contains a pointer to the WSARecvMsg function. The WSAID_WSARECVMSG GUID is defined in the Mswsock.h header file.
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|