问题
Please if you can help me about my problem. On one side I have server with IP 172.27.13.2 connected to the WAN interface of router 172.27.13.1 ...Then on wireless LAN of my router 192.168.1.1 I have connected a few clients. Now I will write code in C where client are requesting some UDP streams from server, then server broadcasts streams to clients, and if some packets get lost clients must send NACK to server. My questions is: Because server and clients are on different subnets how can I broadcast from server? And how the client can send request and NACKs to server because they are in different subnets? Are these problems can be solved by router configurations or in C code?
Thank you for helping
回答1:
You cannot broadcast to different subnets. Routers do not usually forward broadcast packets to different subnets, unless you have a very special router that can be configured properly (e.g. Cisco ...). You could however use multicast for such a task. Here's a C example
Also check this: UDP broadcast packets across subnets
NOTE: some includes in the c example are missing, but they are easy to find
回答2:
As both server & users are in different subnets .As router donot forward broadcast .But we have solution by modifying the router configuration . If you have cisco router & users are connected on cisco switch ,you can use ip helper address command on switch on vlan .You can allow udp packet on router ACL
来源:https://stackoverflow.com/questions/20947557/broadcast-on-different-subnets