title: SocketException: Software caused connection abort
body: <p>I encountered this exception: java.net.SocketException: Software caused connection abort, who can help me.</p>
  
  <pre><code>socket.connect(new InetSocketAddress(Constant.IP_FLY, Constant.PORT_FLY),5000);
              in = socket.getInputStream();
              out = socket.getOutputStream();
              dataOutputStream = new DataOutputStream(out);
              dataInputStream = new DataInputStream(in);
  
  protected byte[] readData = new byte[2048];
  dataInputStream.read(readData);
  </code></pre>
  
  <p>After the socket is connected, the dataInputStream.read(readData) is executed cyclically, and an exception is encountered:</p>
  
  <pre><code>       System.err: java.net.SocketException: Software caused connection abort
  System.err: at java.net.SocketInputStream.socketRead0(Native Method)
  System.err: at java.net.SocketInputStream.socketRead(SocketInputStream.java:114)
  System.err: at java.net.SocketInputStream.read(SocketInputStream.java:170)
  System.err: at java.net.SocketInputStream.read(SocketInputStream.java:139)
  System.err: at java.io.DataInputStream.read(DataInputStream.java:103)
  System.err: at iot.android.com.iott.connection.TcpConnection.readDataBlock(TcpConnection.java:134)
  System.err: at iot.android.com.iott.connection.MAVLinkConnection.run(MAVLinkConnection.java:87)
  </code></pre>
  
  <p>The exception is dataInputStream.read(readData), which is iot.android.com.iott.connection.TcpConnection.readDataBlock(TcpConnection.java:134). Has anyone encountered it, any help will be appreciated!</p>
  
  <p>readDataBlock is executed in the run method, readDataBlock is mainly used to read data: </p>
  
  <pre><code>while(connect){ dataInputStream.read(readData);}. //connect true:connect,false:disconnect
  </code></pre>
  
  <p>It seems to be related to mobile phones. My mobile phone Android 8.1.0 will report the above exception, but using the 8.0 mobile phone test is no problem. </p>