Force close using sockets and AsyncTask

后端 未结 1 548
半阙折子戏
半阙折子戏 2021-01-27 10:16

Hello people of stack....

Please see my class code and my LogCat below...

I am getting a force close when trying to connect. If someone could help me to figure o

1条回答
  •  说谎
    说谎 (楼主)
    2021-01-27 11:05

    I think your problem is here:

     InetAddress serverAddr = InetAddress.getByName(serverIpAddress);
     socket = new Socket(serverAddr, REDIRECTED_SERVERPORT);
    

    I can't find where your serverIpAddress is assigned, thus you get NullPointerException.

    0 讨论(0)
提交回复
热议问题