简体   繁体   English

无法连接到互联网上的服务器

[英]not able to connect to server on internet

I have a very simple client server code written java(server listens on some port and client connects to server port and after connection is established, client ip is displayed on server console). 我有一个用Java编写的非常简单的客户端服务器代码(服务器在某些端口上侦听,客户端连接到服务器端口,并且在建立连接后,客户端ip在服务器控制台上显示)。 This program is working very well in intranet, but if client and server are on internet, my server cannot detect it.I have no firewall installed on my client and server and port forwarding is done on server(I can see it from canyouseeme.org). 该程序在Intranet上运行良好,但是如果客户端和服务器都在Internet上,则我的服务器无法检测到它。我的客户端和服务器上没有安装防火墙,服务器上的端口转发已经完成(我可以从canyouseeme.org看到它) )。

Server is directly connected to modem along with other three computers(they are also connected to modem directly) 服务器与其他三台计算机直接连接到调制解调器(它们也直接连接到调制解调器)

Please help me figure out why I am not able to detect client on internet.Thanks in advance. 请帮助我弄清楚为什么我无法在Internet上检测到客户端。谢谢。

Client code:
------------

String remoteIP = //remote ip
int port =1888;

try{
new Socket(remoteIp,port);
}catch(Exception e){
System.out.println(e.message());
}

Server code
-----------
ServerSocket serversocket = new ServerSocket(port);
Socket socket = serverSocket.accept();
displayIp(socket);

Check your proxy configurations on the client side, see http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html 在客户端检查您的代理配置,请参阅http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html

Which protocol do you use? 您使用哪种协议?

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

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