Windows Dev Center

how to get data from streamsocket inputstream


  • Hi

    I want to get data from inputstream,

    IInputStream^ receivedata = socket->InputStream;     
    auto reader = ref new DataReader(receivedata);
    reader->InputStreamOptions = InputStreamOptions(1);
    task<unsigned int>(reader->LoadAsync(size)).get();
    auto data = ref new Platform::Array<unsigned char>(size);
    task<unsigned int>(reader->ReadBytes(data)).get();
    char* buf = nullptr;
    ::memcpy(buf, data->Data , size);

    i can't find the wrong.

    I find the reason, receive data size is 64kb

    when readdata() it will return Ox8000000b,The operation attempted to access data outside the valid range.

    but I can't resolve this issue

    PS:i'm a rookie

    13 martie 2012 06:15

Toate mesajele