Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
bopeep36 #1
Member since Apr 2012 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: Can FileTransferManager only receive one file transfer at a time?
With the FileTransferManager is it possible to receive files from multiple clients simultaneously? 

Basically I have one receiving FileTransferManager for User A
User B initiates a file transfer, A accepts and the file transfers fine
User C initiates a file transfer, A accepts and the file transfers fine
If users B and C initiate file transfers and A accepts the file transfer from C while B is transmitting, one of the files will end up being zero bytes on the recipient file system, and the client does not appear to get an OnError/OnAbort event.

Reading through the IBB spec I couldn't tell definitively if it supports simultaneous file transfers with multiple clients.  So I'm trying to figure out if I'm hitting a limitation of IBB, my bad use of the library, or a bug in the library. 

My use case is as follows:
I will have several webcams on several machines (B and C in the above example), and on some interval I will take a picture, shrink down the resolution (to 40k or less) and send it to a client (A in the above example) which will accept all the transfers from the webcammed machines and write them to disk on a primary machine. 

I also noticed that if I call send a second time on the file transfer manager before the first transfer completes similar errors occur.  This seems like less of a limitation as the client only needs to send one file at a time, but if the other client can only receive one file at a time that is a non-workable situation for me.

Any ideas on what might be going on and how I can get this to work via MatriX (with Openfire if it matters)?
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

sending multiple files should work. Can you attach the Xml streams of your 3 clients?

The file transfer and IBB is optimized for sending bigger files. Its splits your file into several small chunks and sends them separate. So it does not block you complete XMPP connection while transmitting big files.

For files <=40KB its probably much easier when you just send them in a custom Iq or message when you don't have to interopt with other existing XMPP clients.

IBB does the following:
1) C1: Initialize the transfer
2) C2: accept or deny
3) C1: Send the Open packet and wait for confirmation
4) C1: start sending the chunks and wait for the confirmation of each chunk
5) C1: send the close packet and wait for confirmation

This are at least 5 round-trips. So I think for small files you have more overhead and complexity with IBB than just sending it in one custom packet. I personally would follow the KISS principle here.

Alex
Avatar
bopeep36 #3
Member since Apr 2012 · 3 posts
Group memberships: Members
Show profile · Link to this post
Hello,

Thanks for the information and suggestions, they were extremely helpful.  It is now sending reliably for me.

I worked on capturing the streams like you suggested and the behavior is both clients would negotiate and both would send an open message.  Both clients would get the response and one client would start sending.  The other one would do nothing additional and just stop without any sort of errors.

After messing around a bit I discovered the cause...I am testing with all three clients on one machine, and the two sending clients were sending the same file (the recipient was writing to two different files based on the sender).  So I think what was happening was the first sender was locking the file on open, sending it and the second client was attempting to access the file, sees the lock and silently fails.  The second sender does not attempt to send after the file is unlocked.  Having each client send a different file enabled both clients to send reliably.

In a real use case this situation probably doesn't come up, but I'm a bit concerned that none of the error or abort events on the filetransfermanager were thrown, as I don't see any way I could have programmatically seen that a failure was occurring (other than the fact that no progress events were firing).  Are there any error logs that I can take a look at to diagnose issues like this or another event that I can subscribe to on the underlying xmpp client to see these failures?
This post was edited on 2012-04-14, 03:49 by bopeep36.
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes some error should be raised in this case. I'll take a look at the sources.

Alex
Avatar
bopeep36 #5
Member since Apr 2012 · 3 posts
Group memberships: Members
Show profile · Link to this post
Thanks, please let me know if you need anything from me.
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: