Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

gonzalodiaz

@gonzalodiaz
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Download Speed
    G gonzalodiaz

    Im trying to make an app, that i can download my mails from my account.

    For the test i have 4 mails, total 200kb. When i download the mails, it takes 30 secs.. aprox.. A LOT! and i dont know how to improve the velocity.

    Thanks!

    The code that i use to download is this:

    ns = networkstream from a TCP, buffer 8192.
    private string getemailtest2(int indexservidor)
    {
    StringBuilder resp1 = new StringBuilder();
    bool begin = true;

            int compa = 8193;
            System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
            while (true)
            {
                byte\[\] dataaleer = new byte\[8192\];
                if (ns.DataAvailable || begin)
                {
                    int a = ns.Read(dataaleer, 0, 8192);
                }
                resp1.Append(enc.GetString(dataaleer).Trim('\\0'));
                if (begin)
                {
                    compa = Int32.Parse(resp1.ToString().Split(' ')\[1\]);
                    begin = false;
                }
                int leng = enc.GetBytes(resp1.ToString()).Length;
                if (leng >= compa)
                {
                    if (!ns.DataAvailable)
                    {
                        break;
                    }
                }
    
            }
            return resp1.ToString();
    
    C# performance tutorial code-review
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups