I am new to java networking. I tried to make a server localy (the servet and client on the same machine) and it works with simple chat server. And what iam trying to do is to make it online so i can make a connection between the server hosted on my computer and other computers.
I tried to search on google but whenever i type java server i got things about minecraft -_- java servers! Thanks if you can help.
I have the following setUpNetworking method in my Client class:
private void setUpNetworking(){
try{
InetSocketAddress serverAddress=new InetSocketAddress("127.0.0.1",5000);
SocketChannel socketchannel=SocketChannel.open(serverAddress);
/*
setting up reader and writer .... etc
*/
System.out.println("Networking established");
}catch (IOException ex){
ex.printStackTrace();
}
}
What i should i put instead of "127.0.0.1"
i tried my computer ip address and it didn't prints 'Networking established' and never terminated, same thing happens when i host the server on other computer or on my phone.
Can any one help me i want the connection to go through the internet and get back to my computer.