DatagramSocket::OnMessage handler


  • In my OnMessage handler for DatagramSocket, I want to store away the bytes that my application is receiving into a class member that is defined as Array<BYTE>. When I do that I get a memory access exception. If I instantiate the Array<BYTE> buffer in the handler then no exception is thrown and I can pipe the bytes into memory that is outside of the scope of the even handler. I would like to avoid doing a ref new Array<BYTE> everytime this event handler is invoked. Is there anyway around this? Is there some memory scope issues around WinRT event handlers?
    Tuesday, November 13, 2012 9:31 PM