0
我無法連接到服務器我不知道爲什麼請幫助我。這是我的代碼:錯誤在Asmack Android連接到服務器Xmpp
public class Sample extends Activity{
/** Called when the activity is first created. */
TextView tvHello;
XMPPTCPConnection connection;
ConnectionConfiguration config;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvHello = (TextView) findViewById(R.id.tvHello);
Log.i("ohyeah", "I'm here");
config = new ConnectionConfiguration("host", 5222, "servername");
connection = new XMPPTCPConnection(config);
try {
connection.connect();
// tvHello.setText("Connected to XMPP server");
Log.i("ohyeah", "Successfully Connected");
} catch (XMPPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.e("ohyeah", "Not Connected");
} catch (SmackException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.i("ohyeah", "Something Fishy");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.i("ohyeah", "yes");
}
}
}
這是我的錯誤: http://i.stack.imgur.com/iaRdO.png
還是一樣的錯誤:( – 2014-11-26 01:42:55