none
using ClientWebSocket not able to receive large file from server RRS feed

  • Question

  • I create a project to receive large file(1 MB) from server using clientwebsocket, but i cant receive large file in client side ,this is my code.  what i made change to receive large file, please help me if you have any idea .

                    
    try
    {    
        WebSocketReceiveResult result;
        string receivedMessage = "";
        var message = new ArraySegment<byte>(new byte[4096]);
        do
        {
            result = await client.ReceiveAsync(message, CancellationToken.None);      
            var messageBytes = message.Take(result.Count).ToArray();
            receivedMessage += Encoding.UTF8.GetString(messageBytes);                    
        }
        while (!result.EndOfMessage);
    
        if (!string.IsNullOrEmpty(receivedMessage))
        {
            Console.WriteLine("Received: {0}", receivedMessage);
        }
    }
    catch (Exception ex)
    {
        var mes = ex.Message;
    }



     
    Wednesday, November 28, 2018 5:06 AM

Answers

  •  As my search end ,now code work fine!
    • Marked as answer by Jobish kv Monday, December 3, 2018 7:19 AM
    • Unmarked as answer by Jobish kv Monday, December 3, 2018 9:01 AM
    • Marked as answer by Jobish kv Monday, December 3, 2018 9:02 AM
    Monday, December 3, 2018 7:19 AM

All replies

  • I'd ask for help over here.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages

     

     



    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    Wednesday, November 28, 2018 5:46 AM
    Moderator
  • thanks for your valuable information,unfortunately cant solve this scenario.

    • Edited by Jobish kv Wednesday, November 28, 2018 12:39 PM
    Wednesday, November 28, 2018 12:34 PM
  • thanks for your valuable information,unfortunately cant solve this scenario.

    Hello,

    this is the "Where is"-Forum. So you asked where to get help. I don't see you asked in the forum that Dave Patrick suggested. You should ask there.

    I'm not a moderator who can move your question to the correct forum. You must post there again.

    Regards, Guido

    • Marked as answer by Jobish kv Monday, December 3, 2018 9:01 AM
    • Unmarked as answer by Jobish kv Monday, December 3, 2018 9:01 AM
    Wednesday, November 28, 2018 1:10 PM
    Moderator
  •  As my search end ,now code work fine!
    • Marked as answer by Jobish kv Monday, December 3, 2018 7:19 AM
    • Unmarked as answer by Jobish kv Monday, December 3, 2018 9:01 AM
    • Marked as answer by Jobish kv Monday, December 3, 2018 9:02 AM
    Monday, December 3, 2018 7:19 AM