Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
52xx #1
Member since Sep 2005 · 16 posts
Group memberships: Members
Show profile · Link to this post
Subject: how to transport  files with agsxmpp
now i can register a new count and send message to others.

so the next problem turned out  !

how to transport files between the tow users  !

could you give me a detail ! thanks !
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi,

use the Oob and OobIq classes for that. YOu can find a detailed description about this protocol here:
http://www.jabber.org/jeps/jep-0066.html
There are also other filetransfer protocols in xmpp, but this is the most common. Xmpp is used for sending the filename, IP and Port. The rest works over the HTTP protocol. One client acts as a HTTP server, the other client as a HTTP client. Its also possible to have a HTTP or Webdav server in the middle. That is the best solution for firewalled clients.

Alex
Avatar
52xx #3
Member since Sep 2005 · 16 posts
Group memberships: Members
Show profile · Link to this post
thanks for that , i will attemp to do .

if i get it , i will upload my code.
Avatar
52xx #4
Member since Sep 2005 · 16 posts
Group memberships: Members
Show profile · Link to this post
hi:Alex

really sorry to say , i still cannot manage to transport the file. can you give me a example for that use the agsXMPP ?

52XX
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by "52xx":
really sorry to say , i still cannot manage to transport the file. can you give me a example for that use the agsXMPP ?
52XX

here is a small sample:

client 1 informs client 2 that it wants to transfer a file
  1. agsXMPP.protocol.iq.oob.OobIq oob = new agsXMPP.protocol.iq.oob.OobIq();
  2.  
  3. oob.To = new Jid("to@server.org");
  4. oob.Type = IqType.set;
  5. oob.Query.Description = "desfription for that file";
  6. oob.Query.Url = "http://gnauck.dyndns.org:5530/test.jpg";
  7.  
  8. XmppCon.Send(oob);

client 2 has to check for a Oob Element in the OnIq event handler:

  1. private void XmppCon_OnIq(object sender, agsXMPP.Xml.Dom.Node e)
  2. {
  3.     agsXMPP.protocol.client.IQ iq = e as IQ;
  4.  
  5.     Element query = iq.Query;
  6.    
  7.     if (query !=null)
  8.     {
  9.         if (query.GetType() == typeof(agsXMPP.protocol.iq.oob.Oob))
  10.         {
  11.             agsXMPP.protocol.iq.oob.Oob oob = query as agsXMPP.protocol.iq.oob.Oob;
  12.                    
  13.             string url      = oob.Url;
  14.             string desc     = oob.Description;
  15.         }
  16.     }
  17. }

The IP that client 1 sends is the Internet IP of this client. Client 1 has to open a http server that will send the file. Client 2 has to connect to this http server and download the file. The http stuff is not in the library because its a standard protocol and not a XMPP protocol. But there are tons of samples for that in the web.

When client 2 has downloaded the file over GET successful it should send a result package to client 1. For this take the received packet and modify it:

  1. iq.SwitchDirection();
  2. iq.Type = IqType.result;
  3. iq.Query = null;
  4.  
  5. XmppCon.Send(iq);


For more information please read this protocol:
http://www.jabber.org/jeps/jep-0066.html

Alex
This post was edited on 2015-12-25, 13:52 by Alex.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS