Click here to Skip to main content
15,945,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to allow my computer to send video files to my app (Windows Phone 8).

if file is large size receive memory exception.

how to solve?

this is my code

private async void HandleRequest(StreamSocket socket)
    //Initialize IO classes
    DataReader reader = new DataReader(socket.InputStream);
    reader.InputStreamOptions = InputStreamOptions.Partial;

    // read request
    var stringHeader = await reader.LoadAsync(4);

    if (stringHeader == 0)
       // disconnected

    // get length
    int length = reader.ReadInt32();

    // initiate data
    byte[] data = new byte[length];

    // load and read data
    uint bytes = await reader.LoadAsync((uint)length);

norbitrial 13-Jun-14 15:36pm    
Can you share us which line of your code throws the exception and what the exception detail is? What do you mean by large size?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900