如何解决Android Oreo套接字连接问题

时间:2018-08-05 18:51:25

标签: java android sockets android-wifi android-8.0-oreo

尝试通过Wifi热点创建套接字(IP,端口)时出现此错误。 无法从/ ::(端口33044)连接到/192.168.43.1(端口9802):连接失败:ECONNABORTED(软件导致连接中断)。 如何解决这个问题?

public void run() {

    mRun = true;

    try {


        Log.d("TCP Client", "C: Connecting...");
        //create a socket to make the connection with the server
        socket = new Socket(SERVER_IP, SERVER_PORT);

        try {

            //sends the message to the server
            mBufferOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);

            //receives the message which the server sends back
            mBufferIn = new BufferedReader(new InputStreamReader(socket.getInputStream()));

先谢谢了。 :)

0 个答案:

没有答案