This is with regards to post here
I am able to connect my PC to the local tigase server setup locally(I am using Smack API). Now I am facing problems when I want to connect Android Phone to that server over Wi-Fi. I am able to connect to the local server by using client Beem for android.My XMPP Domain name of the server is my PC name "mwbn43-1" and IP address is "192.168.0.221"(I am able to ping this server from Android Terminal Emulator). In Beem Settings there is an Advanced option where I can specify server I want to connect with(which I have given as IP address).If I don't set this option I am not able to conect.Now here is the snippet of the code I have used for my android client.
XMPPConnection.DEBUG_ENABLED = true;
ConnectionConfiguration config = new ConnectionConfiguration("mwbn43-1",5222);
//ConnectionConfiguration config = new ConnectionConfiguration("192.168.0.221",5222);
config.setSASLAuthenticationEnabled(false);
config.setCompressionEnabled(false);
XMPPConnection xmpp = new XMPPConnection(config);
try {
xmpp.connect();
xmpp.login("admin@mwbn43-1", "tigase");
String host = xmpp.getHost();
String id = xmpp.getConnectionID();
int port = xmpp.getPort();
boolean i = false;
i = xmpp.isConnected();
if(i)
{answer = "Connected to " + host + " via port " + port + " with ID " + id;
answerfield.setText(answer);}
}//end try
catch (XMPPException e) {
answerfield.setText("Failed to connect");
Log.v(TAG, "Failed to connect to " + xmpp.getHost());
e.printStackTrace();
I am also able to connect to google talk server with help of this code.While making connection with local server I tried giving IP adress as well as Host Name to connect.When I give IP addr(192.168.0.221) I get 'No response from server error' with stream:error(host-unknown) and when I give host name(mwbn43-1) I get 'remote-server-timeout(504)' with host unresolved.
I looked at the code of Beem to see how it connects with server but could not find much.I have also given user permissions for Internet.Can anyone please tell me what lines of code should I add to communicate with the local server.
Try 3 argument ConnectionConfiguration constructor. It let's you state host, port and domain. Host and domain doesn't have to be the same values. In you case, I guess:
ConnectionConfiguration config =
new ConnectionConfiguration("192.168.0.221",5222,"mwbn43-1");