Java Networking “Connection Refused: Connect”

后端 未结 5 2157
你的背包
你的背包 2020-12-16 19:32

I have been trying to get a simple networking test program to run with no results.

Server:

import java.io.*;
import java.net.*;

public class ServerT         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 19:54

    These problem comes under the following situations:

    1. Client and Server, either or both of them are not in network.

    2. Server is not running.

    3. Server is running but not listening on port, client is trying to connect.

    4. Firewall is not permitted for host-port combination.

    5. Host Port combination is incorrect.

    6. Incorrect protocol in Connecting String.

    How to solve the problem:

    1. First you ping destination server. If that is pinging properly, then the client and server are both in network.

    2. Try connected to server host and port using telnet. If you are able to connect with it, then you're making some mistakes in the client code.

提交回复
热议问题