Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
martinbach #1
Member since Mar 2009 · 60 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: How to use Socks5 Bytestream or alternatives in MatriX
Hi Alex,

transferring binary data (streaming) is what I want to do.

In the agsXmpp section you wrote that jingle and related technologies are very complex and hard to implement.
That seems not my way ...  for today ;-)

How about socks5 ?

Matrix offers disco and pubsub.

1. Is there any other xmpp related stuff I need to use socks5 with Matrix?
2. I wrote that I have to use a special subset of socks5 to use with xmpp. Can you give me a hint where to find it ?
3. Do you have another suggestion to me how to (fast) transfer binary data (stream) with xmpp
    either inside or out of the xmpp stream?

Thank you.

Martin
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi Martin,

the latest developer version which should be also in the downloads directory has all you need for implementing IBB or SOCKS5 file transfers. But there is no example yet like there is for agsXMPP. So you could use the examples from agsXMPP and just convert the protocol classes to MatriX.

On my ToDo list for one of the next MatriX versions is a complete file transfer control which is very easy to use and reliable. I cannot tell you when it will be available because I am very busy at the moment and this is a complex task.

I also think about a own XMPP extension, because .NET 4.0 has the ability to use Teredo for NAT traversal. Maybe this is an option for you if you don't have to be compatible with other existing clients.
See also: http://msdn.microsoft.com/en-us/library/system.net.sockets…

Alex
Avatar
martinbach #3
Member since Mar 2009 · 60 posts
Group memberships: Members, Premium
Show profile · Link to this post
Hi Alex,

this sounds great.

Where can I get the current dev version?
On   http://www.ag-software.net/downloads.html   I can find only the releases ?

Martin
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by martinbach:
Where can I get the current dev version?
On   http://www.ag-software.net/downloads.html   I can find only the releases ?

yes this is the Url.

Alex
Avatar
Alex #5
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi Martin,

I uploaded a Beta of the upcoming version 1.3 which includes a file transfer control to:
http://www.ag-software.net/downloads.html

Alex
Avatar
johnm60 #6
Member since Jun 2010 · 32 posts
Group memberships: Members
Show profile · Link to this post
hi Alex

I have been trying to get a file transfer going with the file transfer manager, but have got stuck. I wonder if you can prod me in the right direction?

I have created a FileTransferManager

            fm = new FileTransferManager();
            fm.XmppClient = xmppClient;
            fm.OnFile += new EventHandler<FileTransferEventArgs>(fm_OnFile);
            fm.OnStart += new EventHandler<FileTransferEventArgs>(fm_OnStart);
            fm.OnError += new EventHandler<Matrix.ExceptionEventArgs>(fm_OnError);
            fm.OnEnd += new EventHandler<FileTransferEventArgs>(fm_OnEnd);
            fm.OnAbort += new EventHandler<FileTransferEventArgs>(fm_OnAbort);
            fm.OnProgress += new EventHandler<FileTransferEventArgs>(fm_OnProgress);

and set a pile of event handlers. I have made a call from another client to send a file:

Matrix.Jid dest = new Matrix.Jid(destjid);
            fm.Send(dest,"log.txt", "the local log");

In the OnFile, I get a FileTransferEventArgs and I presume I have to do some form of accept, but as far as I can tell there is no specific Iq for this and so I cannot send a response.  Some XMPP trace messages are below:

[5780] xmppClient_OnReceiveXml: <iq from="100100@acme.com/basicclient" to="jolly.john@acme.com/basicclient" type="set" id="MX_5" xmlns="jabber:client">
[5780]   <si id="977325f8-4ede-43d7-b8b7-809ee6a394b9" profile="http://jabber.org/protocol/si/profile/file-transfer" xmlns="http://jabber.org/protocol/si">
[5780]     <file name="log.txt" size="5597" xmlns="http://jabber.org/protocol/si/profile/file-transfer">
[5780]       <desc>the local log</desc>
[5780]     </file>
[5780]     <feature xmlns="http://jabber.org/protocol/feature-neg">
[5780]       <x type="form" xmlns="jabber:x:data">
[5780]         <field var="stream-method" type="list-single">
[5780]           <option>
[5780]             <value>http://jabber.org/protocol/ibb</value>
[5780]           </option>
[5780]         </field>
[5780]       </x>
[5780]     </feature>
[5780]   </si>
[5780] </iq>
[5780] [color=orange]the local log: fm_OnFile [/color]
[5780] xmppClient_OnSendXml: <iq type="error" to="100100@acme.com/basicclient" id="MX_5" xmlns="jabber:client">
[5780]   <error type="auth">
[5780]     <forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
[5780]     <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">offer declined</text>
[5780]   </error>
[5780] </iq>

Where the trace in orange is generated from my OnFile handler.

Any pointers on how I can complete this are welcome.

Regards
John
This post was edited on 2013-03-06, 19:03 by Alex.
Avatar
Alex #7
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you have to accept the file with the FileTransferEventArgs on the OnFile handler

  1. ftea.Accept = true;

I also uploaded an updated the MiniClient example which includes file transfer now. Did you download this example as well?

Alex
Avatar
johnm60 #8
Member since Jun 2010 · 32 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex

I just tried using Accept = true; and the trace gets much further and I can see the OnEnd event too. So far, so good.

I have just got MiniClient and borrowed its Save code and I cannot get any contents to actually be saved. I have tried the MiniClient and I get the same issue in that the Save dialog allows one to choose a directory and file, but then nothing happens (I see no file of the chosen name created in the chose directory):

            var sf = new SaveFileDialog();
            if (sf.ShowDialog() == DialogResult.OK)
            {
                ftea.Directory = Path.GetDirectoryName(sf.FileName);
                ftea.Filename = Path.GetFileName(sf.FileName);
            }

What really confuses me is how the setting of the directory and filename properties are meant to save the file. Is this meant to be the case or is there another step I am missing?

John

Here is the log:

RECV: <iq from="100100@acme.com/MatriX" to="jolly.john@acme.com/MatriX" type="set" id="MX_5" xmlns="jabber:client">
  <open block-size="4096" sid="29e88077-3592-49f8-af51-94063c00077d" stanza="iq" xmlns="http://jabber.org/protocol/ibb" />
</iq>
SEND: <iq type="result" id="MX_5" to="100100@acme.com/MatriX" xmlns="jabber:client" />
RECV: <iq from="100100@acme.com/MatriX" to="jolly.john@acme.com/MatriX" type="set" id="MX_6" xmlns="jabber:client">
  <data seq="0" sid="29e88077-3592-49f8-af51-94063c00077d" xmlns="http://jabber.org/protocol/ibb">REVTVD1qb2huQGpvaG4tYWMyMDUzOTQ1Mw0KTUVTU0FHRT0iOTEwMCxFUlMtSk9CIg0KIjEwMDQsRVJTSjAxMTg1MjAyIg0KIjEwMDEsUkVDMDAzMjMzLzAwMDMiDQoiMTAwNSwzMS8wMy8xMCINCiIxMDA3LDA2OjQzIg0KIjExMDAsUEFZIFRZUEU6QklMTCBFUlMiDQoiMTEwMSxNQUxJTk9XU0tJLCBKT1NFUEgsIE1SIg0KIjExMDMsUkFOR0VST1ZFUiBGUkVFTEFORCINCiIxMTA1LFg5OTNEQlkiDQoiMTEwNyxNQU5VQUwiDQoiMTEwOCxQRVRST0wiDQoiMTExMCxHUkVFTiINCiIxMTE1LDRXRCINCiIxMjAxLDA3OTcwIDE2MDU0MSINCiIxMjAzLDEsMCINCiIxMjA1LEhPTUUgU0VSVklDRSINCiIxMjEwLE1FU1NBR0UgU1BMSVQgSU4gVFdPIEZJTEVTIg0KIjk5OTksMTciDQo=</data>
</iq>
SEND: <iq type="result" to="100100@acme.com/MatriX" id="MX_6" xmlns="jabber:client" />
RECV: <iq from="100100@acme.com/MatriX" to="jolly.john@acme.com/MatriX" type="set" id="MX_7" xmlns="jabber:client">
  <close sid="29e88077-3592-49f8-af51-94063c00077d" xmlns="http://jabber.org/protocol/ibb" />
</iq>
SEND: <iq type="result" to="100100@acme.com/MatriX" id="MX_7" xmlns="jabber:client" />
Avatar
Alex #9
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this is not the complete log, but the part where the file gets transferred. Its only a very small file which is sent in one chunk only, and everything looks fine so far.

Directory:
this is the directory where the file gets saved. When you don't set it then I choose automatically:
  1. ftea.Directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "downloads");

Filename:
There  you can change the filename if you want to. As you can see in the log the filename gets transmitted from the sender to the receiver, and this will be also the default filename. When when desired you can change it to any valid filename you like here.

Alex
Avatar
johnm60 #10
Member since Jun 2010 · 32 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex

OK, I now get it. I was assuming (looking at MiniClient) that the saveDialog was being used at the point at which the file needs to be saved. Now, I can see that the setting of the Directory and Filename properties should be done prior to the OnEnd event so that when this event handler is called, they are set correctly. Is my understanding now correct?

If the above is true, and I auto accept files (rather than accept these manually), how can I choose the file name and directory (other than creating a temporary file name and later moving the file to the new destination)?

Thanks
John
Avatar
Alex #11
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by johnm60:
OK, I now get it. I was assuming (looking at MiniClient) that the saveDialog was being used at the point at which the file needs to be saved. Now, I can see that the setting of the Directory and Filename properties should be done prior to the OnEnd event so that when this event handler is called, they are set correctly. Is my understanding now correct?

the dialog gets called from the OnFile event which gets raised before the file gets transfered. The code in the MiniClient example is a bit ugly and hard to read because the OnFile handler gets locked with a loop where the FileDialog gets called. But I did not find another quick solution and I think its good enough for an example ;-)

Quote by johnm60:
If the above is true, and I auto accept files (rather than accept these manually), how can I choose the file name and directory (other than creating a temporary file name and later moving the file to the new destination)?

You choose the filename and directory exact at the same time where you accept or deny the file transfer. The file gets opened and data is written to the file as it gets received. On the sender side the file gets splitted in small chunks and then transferred over the XMPP connection. When the transfer is complete then the FileStream gets closed.

The IBB method is currently used for the file transfer, not SOCKS5 like the topic sais.

Alex
Avatar
johnm60 #12
Member since Jun 2010 · 32 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex.

One more question (isn't that always the case with me :-))

You say that the FileTransferManager uses IBB. I can see that from the logs. If I had a requirement to do large transfers out of band, what would be your recommended approach and what support does Matrix have for this? Also, is there any intentions to extend Matrix if such support is not in Matrix right now?

Regards
John
Avatar
Alex #13
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi John,

internal MatriX supports everything for SOCKS5 bytestreams, except of the Socks socket. But there is a socks5 socket class in the agsXMPP examples.
OOB file transfers are on my TODO list. But I want an automatic fallback to IBB if the socks5 connection fails.

The fallback is much better and easier when using Jingle. But the jingle specs for this are not final yet, and I think no existing client is using Jingle for file transfer today. I doesn't help many other programmers when MatriX has the best file transfer, but is not compatible to Psi, Spark and other clients. So have to do some more research on this topic and I cannot tell you when this will be available in MatriX. When you browse the forums you can see many fiel transfer related question. I want a rock solid solution which just works. Plug and play.

If this is very important for you I can develop a custom solution based on our professional services for you.

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: MatriX RSS