Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to send datagram packet through Internet?
    primarykey
    data
    text
    <p>I'm trying to make a basic datagram client/server program with Java.</p> <p>I've made the server cling to port 9321 on my local computer.</p> <p>I've made the client on port 9320 on my local computer, then send the data over wireless router network (192.168.1.100) at port 9321 the program works!</p> <p>then i try to send the packet over (via router)internet IP 139.195.12.183(my ip) at port 9321 but it didnt work! there is this exception:</p> <pre><code>java.net.SocketException: Interrupted function call: Datagram send failed </code></pre> <p>i've set the router to forward any request for port 9321 to my computer and then i've set exception for the firewall on my computer on that port</p> <p>this is the source</p> <pre><code>String SERVER = "139.195.12.183"; sendString(SERVER, 9321, "Greetings"); &lt;&lt; private void sendString(String IP, int port, String toSend) { byte[] buf = toSend.getBytes(); DatagramPacket packet = null; try { packet = new DatagramPacket(buf, buf.length, InetAddress.getByName(SERVER), port); ds.send(packet);&lt;&lt; }catch(UnknownHostException e) { System.out.println("unknownhostception"); }catch(IOException e) { System.err.println("ioception "+e.getMessage()); } } </code></pre> <p>i've had another answers from another forum it said:</p> <blockquote> <p>"The way routers work, you can't see your external (WAN) internet address from your internal network (LAN). If that's what you are trying to do, there's nothing wrong, it just won't work.</p> <p>Ian."</p> </blockquote> <p>any explanation?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload