尝试通过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()));
先谢谢了。 :)