Sending files over TCP/ .NET SSLStream is slow/not working

前端 未结 4 1294
终归单人心
终归单人心 2021-01-15 13:59

Im writing an Server/Client Application which works with SSL(over SSLStream), which has to do many things(not only file receiving/sending). Currently, It works

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-15 14:44

    I think Akash Kava is right.

    while (cursize < size) {
        DateTime start = DateTime.Now;
        byte[] buffer = new byte[4096];
        readblocks = fs.Read(buffer, 0, 4096);
        ServerConnector.send("r", getBase64FromBytes(buffer));
        DateTime end = DateTime.Now;
        Console.Writline((end-start).TotalSeconds);
        cursize = cursize + Convert.ToInt64(readblocks);
        ThreadInfos.wait.setvalue((csize / size) * 100);
        end = DateTime.Now;
        Console.Writline((end-start).TotalSeconds);
    }
    

    By doing this you can find out where is the bottle neck.

    Also the way you sending data packets to server is not robust.

    Is it possible to paste your implementation of

    ThreadInfos.wait.setvalue((csize / size) * 100);

提交回复
热议问题