简体   繁体   English

Java Socket连接被我的公共IP拒绝

[英]Java Socket connection refused with my Public IP

I have a client server architecture project in android. 我在android中有一个客户端服务器架构项目。 I cant connect with my public IP to server. 我无法将我的公共IP连接到服务器。 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.. 怎么会这样?..谢谢..

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 如果是Windows,请查找c:\\ Windows \\ System32 \\ drivers \\ etc \\ hosts,如果是linux,请转到/ etc / hosts /文件

Open the file with sudo privileges. 使用sudo权限打开文件。

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

Example:
127.0.0.1 localhost.localdomain localhost

Add your IP here with domain name. 在这里添加您的IP域名。 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? 请添加更多详细信息,例如您的操作系统以及您想要实现的目标?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM