P2P application possible?

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

P2P application possible?

Postby salemar86 » Sat Nov 29, 2008 6:01 pm

Hi, I'm an italian student and

I wolud write an application based on a p2p network.
I read that XMPP is not longer available, so I should implement the p2p protocol manually do you know some information about P2P on Android???
salemar86
Freshman
Freshman
 
Posts: 5
Joined: Sat Nov 29, 2008 5:50 pm

Top

Postby MrSnowflake » Sat Nov 29, 2008 6:14 pm

Use Smack from jivesoft. It's the XMPP lib used by the GTalk client.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

interestin material?

Postby salemar86 » Sat Nov 29, 2008 6:40 pm

have you interesting links or material about smack on android?
salemar86
Freshman
Freshman
 
Posts: 5
Joined: Sat Nov 29, 2008 5:50 pm

Postby MrSnowflake » Sat Nov 29, 2008 10:22 pm

Why would I? It works the same like in regular Java doesn't it?
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Using Smack...

Postby salemar86 » Sun Jan 04, 2009 3:57 pm

I'm using Smack to realize my p2p application, but I can't connect to my local openfire server...

If I run this code as a java application I have no problem, but if i run it as Android project my connection is refused...

My simple code:


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import org.jivesoftware.smack.ConnectionConfiguration;
  2.  
  3. import org.jivesoftware.smack.SASLAuthentication;
  4.  
  5. import org.jivesoftware.smack.XMPPConnection;
  6.  
  7. import org.jivesoftware.smack.XMPPException;
  8.  
  9.  
  10.  
  11. import android.util.Log;
  12.  
  13.  
  14.  
  15. public class GatewayConnection {
  16.  
  17.        
  18.  
  19.         public static final String SERVER="localhost";
  20.  
  21.         public static final int PORT=5222;
  22.  
  23.         public static final String TAG="XMPP";
  24.  
  25.        
  26.  
  27.         XMPPConnection conn;
  28.  
  29.        
  30.  
  31.         public GatewayConnection(){
  32.  
  33.                
  34.  
  35.                 ConnectionConfiguration config = new ConnectionConfiguration(SERVER,PORT);
  36.  
  37.                
  38.  
  39.                 config.setCompressionEnabled(false);
  40.  
  41.                 config.setSASLAuthenticationEnabled(false);
  42.  
  43.                 config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
  44.  
  45.                
  46.  
  47.                 conn= new XMPPConnection(config);
  48.  
  49.                
  50.  
  51.                 try{
  52.  
  53.                
  54.  
  55.                 conn.connect();
  56.  
  57.                 }
  58.  
  59.                 catch(XMPPException e){
  60.  
  61.                         e.printStackTrace();
  62.  
  63.                
  64.  
  65.                 }
  66.  
  67.                 SASLAuthentication.supportSASLMechanism("PLAIN", 0);
  68.  
  69.                
  70.  
  71.                
  72.  
  73.                 try{
  74.  
  75.                 conn.login("android", "password");");}
  76.  
  77.                 catch (XMPPException e){
  78.  
  79.                         e.printStackTrace();
  80.  
  81.                 }
  82.  
  83.                
  84.  
  85.         }
  86.  
  87.  
  88.  
  89. }
  90.  
  91.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


I also include the internet permission in the manifest.
The error occurs after the line conn.connect();

Any suggestion???

Thank you in advance
salemar86
Freshman
Freshman
 
Posts: 5
Joined: Sat Nov 29, 2008 5:50 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 1 guest