Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
pcfriend2010 #1
Member since Feb 2012 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: I have a question.
I am using agsXMPP with openfire 3.7.1 (over BOSH)

I need to file transter to smack api user with 80 port.

I have some sample smack api sample but i don't have agsXMPP sample for file transfer using vb.net.

do you have any sample vb.net source?

if you have please send to me.

my email address pcfriend2010@gmail.com
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
If you search the forums for file transfer you will find many code examples.
There are many different protocols for file transfer in XMPP. So first you must figure out which file transfer protocol your Smack code is  using.

Alex
Avatar
pcfriend2010 #3
Member since Feb 2012 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: This is my code using smack api
    private void FileSend(String jid) {
        FileTransferManager manager = new FileTransferManager(this.connection);
        OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(jid);
        try {
            System.out.println("000");
            transfer.sendFile(new File("c:/Temp/test.pdf"), "Moo !");
            System.out.println("111");
            while(!transfer.isDone())
            {
                System.out.println(transfer.getProgress() + " is done!");
                //System.out.println(transfer.getStreamID() + " is done!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        } catch (XMPPException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
   
    public void SetfileReceiver(final boolean accept, final String fileName) {
        // Create the file transfer manager
         final FileTransferManager manager = new FileTransferManager(this.connection);

        // Create the listener
        manager.addFileTransferListener(new FileTransferListener() {
            public void fileTransferRequest(FileTransferRequest request) {
                // broadcast something here. Wheather users want to accept file
                // Check to see if the request should be accepted
                if (accept) {
                    // Accept it
                    IncomingFileTransfer transfer = request.accept();
                    try {
                        transfer.recieveFile(new File(fileName));
                        System.out.println("File " + fileName
                                + "Received Successfully");
                        bThread = true;
                        // InputStream input = transfer.recieveFile();
                    } catch (XMPPException ex) {

                    }
                } else {
                    // Reject it
                    request.reject();
                }
            }
        });
    }
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