I wrote a server and client Java TCP Socket, It works on private network(192.168.2.x) but how I have no idea how make it work with public ip. I think I should open a port in the router and use my server ip and this port to init client socket! I tried it and did not work.
Init of sockets here:
Socket clientSocket = new Socket(IP, PORT);
ServerSocket server = new ServerSocket(PORT);