UDP multicast using winsock API differences between XP and Vista

后端 未结 3 928
Happy的楠姐
Happy的楠姐 2021-02-10 04:59

It seems to be that the implementation required to set up a UDP multicast socket has changed between windows XP and windows vista. Specifically:

  • Under windows X

相关标签:
3条回答
  • 2021-02-10 05:25

    Well very old question, but does someone know how to check which version of winsock is present on the machine?

    I have some old machines still using xp or server 2003. But testing for the windows version does not help, it seems it is possible to have an windows version 5.1, which is not accepting the bind before, and a machine having 5.2 Version accepting it.

    0 讨论(0)
  • 2021-02-10 05:30

    What error are you getting from the setsockopt() call that you make to apply IP_ADD_MEMBERSHIP and join the multicast group?

    I've just run some tests here with my server framework and I note that I DO call bind() on Windows 7 (I don't have a Vista box to hand) and I can then also join a multicast group as expected as long as both the binding address and the multicast address are valid.

    However I cannot call bind() with INADDR_ANY, as that causes the joining of the multicast group to fail with error 10022 (WSAEINVAL) and if the multicast group address isn't a valid multicast address the call fails with error 10049 (WSAEADDRNOTAVAIL). Which all seems fair enough.

    I'm booting an XP box now...

    [Edited after testing on XP]

    On XP it's legal to bind() to INADDR_ANY and it's legal to use invalid multicast addresses. So, I expect, you're doing one of those and it therefore works on XP and not on Vista/Win7.

    So, what error are you getting and what address are you binding to?

    0 讨论(0)
  • 2021-02-10 05:41

    I don't know about this specific question, but I do know that the network stack was rewritten from scratch for Vista

    0 讨论(0)
提交回复
热议问题