Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Socket connection refused with my Public IP

I have a client server architecture project in android. I cant connect with my public IP to server. I closed firewall, and did the port redirection for server. My friend can connect from outside to my server, but i can't, why? how can it be?.. Thanks..

like image 800
Berkay Aras Avatar asked Jul 10 '26 14:07

Berkay Aras


1 Answers

Which OS are you running your client server code. If Windows, look for c:\Windows\System32\drivers\etc\hosts, if it's linux go the /etc/hosts/ file

Open the file with sudo privileges.

Format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>

Example:
127.0.0.1 localhost.localdomain localhost

Add your IP here with domain name. Your Domain Name can be anything and try again. Also your question is a bit vague. Please add more details such as your os env and what exactly are you trying to achieve?

like image 116
Dhawan Gayash Avatar answered Jul 13 '26 15:07

Dhawan Gayash