Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I have several LANs(10.0.0.x) connected to a WAN(192.168.1.x). Each through a router that allows a network drirected broadcast. This is to allow the devices in the LANs to be discovered by devices on the WAN.
I can send a broadcast on the LAN(10.0.0.255) and receive it on my socket. But when I move to the WAN I can see it in wireshark, but not my socket. I other words I have a decive with address 10.0.0.1 sending the same message to 192.168.1.255 through a gateway but my socket is not receiving it. When this happens the source address is the addres of the router. Here is the code for my socket:

C#
udpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
//Assign the any IP of the machine and listen on port number 5000
IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Any, 5000);
//Bind this address to the server
udpSocket.Bind(ipEndPoint);
IPEndPoint ipeSender = new IPEndPoint(IPAddress.Any, 5000);
//The epSender identifies the incoming clients
EndPoint epSender = (EndPoint)ipeSender;
                        
//Start receiving data
udpSocket.BeginReceiveFrom(byteData, 0, byteData.Length,
SocketFlags.None, ref epSender, new AsyncCallback(ReceiveAnnounce), epSender);
Posted

1 solution

hi,

just an idea:
do you have activated port forwording to your ip-address ?

greetz
 
Share this answer
 
Comments
Klockness 29-Jul-13 15:58pm    
Yes, I can also see the message on this socket it I send it directly to my IP address instead of broadcast so I don't think it has to do with port forwarding.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900