-
June 20th, 2014, 06:50 AM
#1
Using the same port for 2 UDP Multicast groups
I habe a program, that can send and receive UDP Multicast telegrams. When I open the socket then I bind my multicast group address and the local port to a specified networkcard (our PC has 2 network cards). Now I have a special constellation:
Our PC has 2 network cards. Multicast group 1 shall use card 1 and group shall use card 2. As long as both groups use different local ports it works fine. But when both group want to use the same port number then I can receive and send telegrams only through the first group that was created. For the second one I don't even get a FD_READ event at all.
Code:
SrvAddr.sin_family = AF_INET;
SrvAddr.sin_port = htons( (WORD) nLocalPort );
SrvAddr.sin_addr.s_addr = inet_addr(strOwnIpAddress); // bind multicast group socket to a specified networkcard
// If bind socket to port failed
if( bind( hSocket,
(const struct sockaddr *) &SrvAddr,
sizeof(SrvAddr) ) == SOCKET_ERROR )
{
WSACloseEvent(ptChannel->Overlapped.hEvent);
closesocket(hSocket);
WSACleanup();
return ceUdpErrBind;
} // END OF If bind socket to port failed
-
June 20th, 2014, 07:56 AM
#2
Re: Using the same port for 2 UDP Multicast groups
I found my mistake. Problem is solved
-
June 25th, 2014, 02:46 AM
#3
Re: Using the same port for 2 UDP Multicast groups
Originally Posted by grka
I found my mistake. Problem is solved
Will you be so kind to share your solution?
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
|