T
T
twobomb2016-01-30 13:41:06
Java
twobomb, 2016-01-30 13:41:06

Java Sockets. Client - Server. Why does not it work?

In general, I decided to learn the basics of working with sockets in Java.
Wrote a simple prog server. It listens on a port, and incoming text sends back a connection number assignment. d132409212fb429391e9cddb2085dd2b.png
Also wrote a simple prog client. It sends plain text to the specified address and port and displays the server response or an error. 8f2b5f76db6a4c599527b987adae6c38.png
So here's the crux of the matter.
When the server is running, I send data to localhost, everything works, when I send it to the ip that the router gave me 192.168.0.100, everything also works, but when I send it to my real ip taken from 2ip.ru, nothing works. Turned off the firewall, same thing.
d70daece3266492bab1bc679d6065af1.png
Please tell me what is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Malyarov, 2016-01-30
@twobomb

You would start with networks, not with sockets.
Who will do PORT FORWARDING?
Let's say you have three computers in your LAN. When a request arrives at the router, the router must know which of the three ports to send the request to - port forwarding is responsible for this.
What model of router do you have?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question