Not logged in. · Lost password · Register
Forum: agsXMPP RSS
surjith #1
Member since Apr 2006 · 7 posts · Location: Pondicherry
Group memberships: Members
Show profile · Link to this post
Subject: File Transfer problem
Hi everyone.

For file transfer i used the following code:


        private void button1_Click(object sender, EventArgs e)
            odlgfile.ShowDialog();  //odlgfile is the open file dialog control name

            Oob xit = new Oob();

            Jid to = new Jid("vathan@vathan");

            IQ fiq = new IQ(IqType.set);
            fiq.To = to;
            fiq.From = new Jid("surjith@vathan");
            xit.Url = odlgfile.FileName;
            xit.Description = "test file";
            agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message();

            msg.Type =;
            msg.To = m_Jid;
            msg.Body = rtfSend.Text;
            rtfSend.Text = "";

here I get the resultant output in the debug window:

SEND: <iq xmlns="jabber:client" type="set" to="vathan@vathan" from="surjith@vathan"><query xmlns="jabber:iq:oob"><url>C:\Documents and Settings\surjith.TURTLEINDIA\Desktop\xmas01_cola2.mpg</url><desc>test file</desc></query></iq>

SEND: <message xmlns="jabber:client" type="chat" to="vathan@vathan/Exodus"><body /></message>

RECV: <iq type="error" from="vathan@vathan" to="surjith@vathan/MiniClient"><query xmlns="jabber:iq:oob"><url>C:\Documents and Settings\surjith.TURTLEINDIA\Desktop\xmas01_cola2.mpg</url><desc>test file</desc></query><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

for the file is not getting transferred to the destination jid. can any one please help me for this. Thanks in advance.
Alex #2
Member since Feb 2003 · 4280 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post

  • IQs must always be send to a full Jabber Id. You set the Iq to a bare Jid. This is why the server returns an error.
  • Why do you send an empty message after your IQ?
  • You can build your IQ easier when using the OobIq class instead of the Oob class.

You set a local path in the Url property. This is wrong here. It should look like http://mypublicIP/filename.txt
And agsXMPP doesnt transfer the file for you. After sending the IQ you have to open a socket which listens and will transfer the file over the HTTP protocol (small simple webserver). The second client has to download the file from your small webserver by using a simple HttpWebRequest for example.

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