Answer the question
In order to leave comments, you need to log in
How to send a packet beyond NAT?
There is a local network. It has multiple routers.
It is necessary to send a packet to all clients..
When using a similar code in JAVA
public class SendAll {
static DatagramSocket s;
static DatagramPacket dp;
public SendAll(String Line){
try{s=new DatagramSocket();
}catch(Exception ex){}
try{sendString(Line);
}catch(Exception ex){}
s.close();
}
static void sendString(String str)throws IOException{
byte[]buf=str.getBytes();
dp=new DatagramPacket(buf,buf.length,InetAddress.getByName(main.Const.BROADCAST),main.Const.PORT);
s.send(dp);
}
}
Answer the question
In order to leave comments, you need to log in
If I understand the code correctly, then you are trying to send a UDP broadcast. If so, then no way. Routers usually never broadcast beyond their own network so that there are no network storms.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question