Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse Communications Framework (ECF) » File transfer problem
File transfer problem [message #618684] Sat, 02 June 2007 09:25 Go to next message
Eclipse UserFriend
Originally posted by: zhouziyu113.yahoo.com.cn

Hi folk!
I have written a Instant Messing application base on xmpp protocol use ECF, and I have implemented registeer,login,roster managent(add,delete),and one-to-one chat,when I want to use the filetransfer in the ECF to implements file transfer function, no matter how did I try,one send request,but the other have no response, the server I use is Openfire 3.3.0,it support xmpp file transfer specification XEP-0096,are they compatible?
There are two Adapter in the filetransfer partition: IOutgoingFileTransferContainerAdapter and IRetrieveFileTransferContainerAdapter, I just want to send and receive, do I have to use the second one? and the process? thanks!
Re: File transfer problem [message #618686 is a reply to message #618684] Sat, 02 June 2007 21:14 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
Hi Given,

Given wrote:
> Hi folk!
> I have written a Instant Messing application base on xmpp protocol use ECF, and I have implemented registeer,login,roster managent(add,delete),and one-to-one chat,when I want to use the filetransfer in the ECF to implements file transfer function, no matter how did I try,one send request,but the other have no response, the server I use is Openfire 3.3.0,it support xmpp file transfer specification XEP-0096,are they compatible?

They should be.

See below...I think the problem might be a simple matter of registering
a listener. If the below doesn't fix things then see **.

> There are two Adapter in the filetransfer partition: IOutgoingFileTransferContainerAdapter and IRetrieveFileTransferContainerAdapter, I just want to send and receive, do I have to use the second one?


No, if you are using the peer-initiated file transfer then its only
necessary to use the IOutgoingFileTransferContainerAdapter. But in
order to *receive* requests (on all potential receivers) you have to

On (potential) receiver(s):
1) Get an IOutgoingFileTransferContainerAdapter.
2) Call
IOutgoingFileTransferContainerAdapter.addListener(IIncomingF ileTransferRequestListener
yourListener)

On sender:
1) Get an IOutgoingFileTransferContainerAdapter.
2) Call IOutgoingFileTransferContainerAdapter.sendOutgoingRequest(.. .)

On the receiver, the
IIncomingFileTransferRequestListener.handleFileTransferReque st(...) will
be called, and you can do what you need/want to do with the request
(refuse it, accept, etc).

So I think the problem might be that you are *not* be calling the
addListener method on the receivers...and therefore when you send a
request no one is listening :). Is this the problem? If not, then see
below.

Just to summarize

Sender Receiver(s)

Calls addListener(rl)

Calls sendOutgoingRequest -> rl.handleFileTransferRequest

handleTransferEvent <- r1.accept/reject


If you want example code that does this, see (in the
/cvsroot/technology/org.eclipse.ecf/tests CVS module), in the
org.eclipse.ecf.tests.filetransfer plugin) the OutgoingFileTransferTest
class.

I've also included the important code from OutgoingFileTransferTest below.

and the process? thanks!


Sure, hope this helps.

Scott



**
We are using Smack 2.2.1 library to implement the ECF xmpp filetransfer.
I have not specifically tested against the Openfire 3.3.0 server,
however (we are using 2.4.0 still with ecf.eclipse.org and this is all
that I've been able to test against to this point).

So this seems likely to be a problem with Openfire 3.3.0<->Smack 2.2.1
file transfer interop. Would you please file a bug here?

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=ECF

As well, would you be able to turn on logging on the Openfire 3.3.0
server and report any notifications caused by the send file request?

----OutgoingFileTransferTest.java

package org.eclipse.ecf.tests.filetransfer;

import java.io.File;
import java.io.FileOutputStream;

import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDCreateException;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.filetransfer.IFileTransferListener;
import org.eclipse.ecf.filetransfer.IIncomingFileTransferRequestLis tener;
import org.eclipse.ecf.filetransfer.IOutgoingFileTransferContainerA dapter;
import org.eclipse.ecf.filetransfer.events.IFileTransferEvent;
import org.eclipse.ecf.filetransfer.events.IFileTransferRequestEven t;
import org.eclipse.ecf.tests.ContainerAbstractTestCase;

/**
*
*/
public class OutgoingFileTransferTest extends ContainerAbstractTestCase {

<stuff deleted>

// Here's where the requestListener is created
protected IIncomingFileTransferRequestListener requestListener = new
IIncomingFileTransferRequestListener() {

public void handleFileTransferRequest(IFileTransferRequestEvent event) {
System.out.println("receiver.handleFileTransferRequest(" + event + ")");
try {
File dir = new File(TESTTARGETPATH);
dir.mkdirs();
File f = new File(dir, event
.getFileTransferInfo().getFile().getName());
FileOutputStream fos = new FileOutputStream(f);
event.accept(fos,receiverTransferListener);
//event.accept(f);
} catch (Exception e) {
e.printStackTrace(System.err);
fail("exception calling accept for receive file transfer");
}
}

};

<code deleted>

public void testTwoClientsToSendAndReceive() throws Exception {
// Setup two clients. Client 0 is the receiver, client 1 is the sender
setClientCount(2);
clients = createClients();
// Here it sets up the requestListener...so that adapter0 can respond to
// requests
adapter0 = getOutgoingFileTransfer(0);
adapter0.addListener(requestListener);
adapter1 = getOutgoingFileTransfer(1);
// this just connects the clients
for (int i = 0; i < 2; i++) {
connectClient(i);
}
// Here the adapter1 sends the request
adapter1.sendOutgoingRequest(getServerConnectID(0), new File(
TESTSRCFILE), senderTransferListener, null);

sleep(20000);

disconnectClients();

}

}
Re: File transfer problem [message #618689 is a reply to message #618686] Mon, 04 June 2007 09:54 Go to previous message
Eclipse UserFriend
Originally posted by: zhouziyu113.yahoo.com.cn

Hi Scott!
I am very sorry for saying up that have wasted you time
the problem has been solved!thanks!
there was no something seriouly,
what I have done was that I tested the source code just on one machine
when I use two,there was no problem,no question about the compatible between ECF and Openfire 3.3.0 file transfer specification
Now I can use the file transfer API to implments file transfer functions.
Previous Topic:Re: How to develop a complete ECF base XMPP application
Next Topic:ECF RC1.5 build
Goto Forum:
  


Current Time: Fri Apr 26 20:01:12 GMT 2024

Powered by FUDForum. Page generated in 0.03053 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top