How to do a UDP multicast across the local network in c#?

后端 未结 3 1605
庸人自扰
庸人自扰 2020-12-28 21:31

I am trying to get some simple UDP communication working on my local network.

All i want to do is do a multicast to all machines on the network

Here is my se

3条回答
  •  伪装坚强ぢ
    2020-12-28 21:56

    I can't see a TTL specified anywhere in the code. Remember that TTL was originally meant to be in unit seconds, but is has become unit hops. This means that by using a clever TTL you could eliminate passing through the router. The default TTL on my machine is 32 - I think that should be more than adequate; but yours may actually be different (UdpClient.Ttl) if your system has been through any form of a security lockdown.

    I can't recommend the TTL you need - as I personally need to do a lot of experimentation.

    If that doesn't work, you could have a look at these articles:

    • OSIX Article
    • CodeProject Article

    All-in-all it looks like there has been success with using Sockets and not UdpClients.

    Your chosen multicast group could also be local-only. Try another one.

    Your physical network layer could also be causing issues. I would venture to question switches and direct (x-over) connections. Hubs and all more intelligent should handle them fine. I don't have any literature to back that, however.

提交回复
热议问题