简体   繁体   中英

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). 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).

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.

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

Which protocol do you use?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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