Author Topic: Get Multiple Files  (Read 11435 times)

Raj

  • Guest
Get Multiple Files
« on: June 04, 2008, 08:36:16 AM »
Hi

I am using WCL.net lite. I am trying to get all files from my mobile listed under one folder.

when I loop through the files and get , an error is thrown like asynchronous process in progress.
Please let me know how I could do that.


private void btnGetAllFiles_Click(object sender, EventArgs e)
        {
            if (lvFTP.Items.Count > 0 )           
            {
                //Loop all items.
                for (int i = 0; i < lvFTP.Items.Count; i++)
                {
                    if (lvFTP.Items.SubItems[1].Text == "File")
                    {
                        strFileName = lvFTP.Items[0].Text;
                        wclFTPClient.Get(lvFTP.Items[0].Text);
                    }
                }
            }
           
        }

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Get Multiple Files
« Reply #1 on: June 04, 2008, 10:18:30 AM »
Get is asynchroniouse operation. When file received OnGetCOmplete event fires. Only after that you can get other file.

Raj

  • Guest
Re: Get Multiple Files
« Reply #2 on: June 04, 2008, 11:01:42 AM »
I know that, problem is "get" method is asynchronously callig the delegate "wclFTPClient_GetComplete" but didn't notify for the completion of event,

Can you please suggest me that is there any class or method by which I can get all the files at one event.

can I make multiple instances of wclFTPClient, and fire them.

Please let me know
« Last Edit: June 04, 2008, 11:05:47 AM by Raj »

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Get Multiple Files
« Reply #3 on: June 04, 2008, 12:56:31 PM »
There is no way to get file files by one call.

Raj

  • Guest
Re: Get Multiple Files
« Reply #4 on: June 04, 2008, 02:13:50 PM »
how can i get the multiple files ?
Do I need to call wclFTPClient.Get() multiple times.

if yes then how will I know that GetCompleted event is fired ?
Please suggest me something.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Get Multiple Files
« Reply #5 on: June 04, 2008, 04:17:49 PM »
Yes, you need to call Get multiple times.

Does the event fire in Demo app?

Raj

  • Guest
Re: Get Multiple Files
« Reply #6 on: June 10, 2008, 11:02:07 AM »
I have call dir function from end event of get function.

Thanks for ur support.

conatwill

  • Guest
Re: Get Multiple Files
« Reply #7 on: September 26, 2008, 04:59:16 AM »
Since the Get is asynchroniouse operation, so how does the Put work? Sometimes, the Put block and the cpu occupancy is up to almost 100%, why? How dose the wcl lead to this case?My code as follows(the connection is ok):


            this.wclFTPClient = new wclnet.wclFTPClient();
            this.wclFTPClient.AutoDetect = true;
            this.wclFTPClient.ClientTransport = wclnet.wclClientTransport.ctBluetooth;
            this.wclFTPClient.Target = new System.Guid("f9ec7bc4-953c-11d2-984e-525400dc9e09");
                    //Create the stream
                    Stream FileStream = null;
                    try
                    {
                        FileStream = new FileStream(filename, FileMode.Open);
                        wclFTPClient.Put(filename, FileStream);
                    }
                    finally
                    {
                        if (FileStream != null)
                        {
                            FileStream.Close();
                            FileStream = null;
                        }
                    }

Best Regards!

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Get Multiple Files
« Reply #8 on: September 26, 2008, 07:28:08 AM »
Good day!

Pus is async as well. You do not need close the stream immeditally. Wait when OnComplete even fires and then release the stream.

conatwill

  • Guest
Re: Get Multiple Files
« Reply #9 on: September 26, 2008, 07:34:21 AM »
      I copy code from the wcl demo as follows, and in this function, the stream is also closed after Put, so what's the problem? and in which cases, the Put will block and make the cpu occupancy up to 100%?

  private void btFTPPut_Click(object sender, EventArgs e)
        {
            if (OpenDialog.ShowDialog() == DialogResult.OK)
            {
                Stream Stream = new FileStream(OpenDialog.FileName, FileMode.Open);

                try
                {
                    String AFile = System.IO.Path.GetFileName(OpenDialog.FileName);
                    wclFTPClient.Put(AFile, Stream);
                }
                finally
                {
                    Stream.Close();
                    Stream = null;
                }
            }
        }

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Get Multiple Files
« Reply #10 on: September 26, 2008, 08:54:39 AM »
What is bluetooth drivers?

conatwill

  • Guest
Re: Get Multiple Files
« Reply #11 on: September 26, 2008, 09:15:54 AM »
The bluedriver is Widcomm, and another strange question is : When I list files of the remote server(my pda),  an null file existin the folder,and this file has the same name as the folder which includes it but the size of it is 0, and each foler opend has the file of this type, when I get it, the wcl show the error : access point error and exit, After I check the remote device, there is no this file;

Thanks for your reply.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Get Multiple Files
« Reply #12 on: September 26, 2008, 09:54:42 AM »
Thanks for the report. I will check and fix asap

Raj

  • Guest
Re: Get Multiple Files
« Reply #13 on: October 20, 2008, 05:31:21 PM »
Hi Mike,

Thanks for your valuable answers.

First, I am able to make different connect simultaneously as well as I am getting the files from those active connections.

Mike, I need to know, that may I attach a custom object/tag/value with wclFTPClient Object ?
One thing more the transfer rate of file is two slow, i am checking the different and glot wclObexParam class, in that i checked Param Size, can we change these param size.

wclOBEXParams objwclOBEXParams = new wclOBEXParams();
 objwclOBEXParams.PacketSize = ????

can we make chages like this to make file transfer fast ?



Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Get Multiple Files
« Reply #14 on: October 20, 2008, 05:56:12 PM »
Of course yu can change it and it may help. But actually the transfering speed hard depend on the hardware.

 

Sitemap 1 2 3 4 5 6 7 8 9