smack 4.2.0+openfire 4.1.3 When it comes to the method “connection()”, it has always been like this:
org.jivesoftware.smack.SmackException$ConnectionException: The following addresses failed: ‘192.168.1.112:5222’ failed because: /183.207.232.253 exception: java.net.SocketTimeoutException: connect timed out
My Android phone and laptop are in the same LAN
public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); new Thread(new Runnable() {
@Override
public void run() {
try {
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setXmppDomain("192.168.1.112")
.setHost("192.168.1.112")
.setCompressionEnabled(false)
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
.build();
AbstractXMPPConnection conn = new XMPPTCPConnection(config);
conn.connect();
} catch (InterruptedException | IOException | SmackException | XMPPException e) {
e.printStackTrace();
}
}
}).start();
}
}