Receiving multiple multicast feeds on the same port - C, Linux

前端 未结 8 1129
予麋鹿
予麋鹿 2020-11-29 04:59

I have an application that is receiving data from multiple multicast sources on the same port. I am able to receive the data. However, I am trying to account for statistics

8条回答
  •  时光取名叫无心
    2020-11-29 05:39

    Use setsockopt() and IP_PKTINFO or IP_RECVDSTADDR depending on your platform, assuming IPv4. This combined with recvmsg() or WSARecvMsg() allows you to find the source and destination address of every packet.

    Unix/Linux, note FreeBSD uses IP_RECVDSTADDR whilst both support IP6_PKTINFO for IPv6.

    • http://www.kernel.org/doc/man-pages/online/pages/man7/ip.7.html

    Windows, also has IP_ORIGINAL_ARRIVAL_IF

    • http://msdn.microsoft.com/en-us/library/ms741645(v=VS.85).aspx

提交回复
热议问题