Home Forums .NET libraries Xceed SFTP/FTP for .NET Display Speed [Please Help!]

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #21314 |

    HI everyone outthere.

     i really need help with something if you could help i would really appreciate it

    what i need is let say i made a label in my visual basic 2010 project and called the label1 as speed:

    and i want label1 which is speed: to display the speed of the file downloading from the ftp

    if you could give me a code for visual basic 2010 that would be great

    here is how i mean in label1 is speed: 0.00 so i want it to display the speed in killo bytes per second of the file downloading from the ftp

    dl 

     

    many thanks in advance

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by home (had 2066 views)

    Xceed Support
    Member
    Post count: 5658

    Hi,

    The download speed in Kb is related to the speed of your internet connection; it has not connected in any way to our FTP component.

    However, you can implement the Downloaded bytes (from your screenshot) using these events:

    public void OnByteProgression(

          string currentItemName,

          long currentItemsByteProcessed,

          long currentItemTotalBytes,

          byte currentItemPercent,

          long allItemsByteProcessed,

          long allItemsTotalBytes,

          byte allItemsPercent,

          object userParams )

        {

          if( ( currentItemTotalBytes == 0 ) || ( allItemsTotalBytes == 0 ) )

            return;

         

          if( allItemsPercent != m_resultsForm.TransferProgress.Value )

            m_resultsForm.TransferProgress.Value = allItemsPercent;

        }

       

        public void OnItemProgression(

          string currentItemName,

          long itemProcessed,

          long totalItemCount,

          byte totalItemPercent,

          ref bool abort,

          object userParams )

        { 

          if( itemProcessed == totalItemCount )

          {

            Console.WriteLine( “Process completed.” );

          }

          else

          {

            txtDownloaded.Text = ( “Current item processed: ” + currentItemName + ” (%” + totalItemPercent + “)” );

          }

        }

     

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Alain [Xceed] (had 178 views)

    User (Old forums)
    Member
    Post count: 23064

    i know i just want it to show the speed of my internet connection like when u download something from the internet it tells you the speed i want it to do the same for my project. 

    when i put the public void and others i get error saying something like end statment expected.

    also there are a lot more errrors i get is this for visual basic 2010

    if it is could u please make it so like i have label1 which i want it to show the speed so u put it  in the code u gave me please.

    thanks in advance 

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by home (had 331 views)

    Xceed Support
    Member
    Post count: 5658

    Hi,

    You are getting errors because the code I sent is in C#, but you are using VB.Net.

    The code above is for your second label: “Downloaded”; For your “Speed” label, there is no built-in way in our component that provides this; you will have to calculate it by yourself.

    Our sample: ClientFTP shows an example on how to do this; please open that sample and look at the folowing function:

    private string FormatSpeed( long bytesPerSecond )

    {

    // Format the received speed to a readable format.

    double speed = bytesPerSecond;

    // Bytes per second.

    string formattedSpeed = speed.ToString( “n2” ) + ” bytes/Sec”;

    // KB per second. (only if at least 1 kb/sec)

    if( speed > 1024 )

    {

    speed /= 1024;

    formattedSpeed = speed.ToString(

    “n2” ) + ” KB/Sec”;

    // MB per second. (only if at least 1 mb/sec)

    if( speed > 1024 )

    {

    speed /= 1024;

    formattedSpeed = speed.ToString(

    “n2” ) + ” MB/Sec”;

    }

    }

    return formattedSpeed;

    }

     

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Alain [Xceed] (had 184 views)

    User (Old forums)
    Member
    Post count: 23064

    ok i will try to take a look at it and hope i find it 

    can you please give me a code for the second label downloaded in visual basic 2010 code

    tnx

    and if there is one for speed vb 2010 code that wold be great

    thanks for your reply 

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by home (had 1685 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.