The remarks in NetworkStream include the following sentence.
The NetworkStream does not support random access to the network
If you want to use it, you can use AsInputStream or AsOutputStream instead of AsRandomAccessStream.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I create socket and want to write data to the socket.
and I find the networkstream
NetworkStream stream =new NetworkStream(socket);
stream.AsRandomAccessStream() throws exception
how to get randomAccessStream from socket or networkStream?
The remarks in NetworkStream include the following sentence.
The NetworkStream does not support random access to the network
If you want to use it, you can use AsInputStream or AsOutputStream instead of AsRandomAccessStream.
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
5 deleted commentsComments have been turned off. Learn more
The network data stream does not support random access by design as @gekka answered. But you can copy it to a stream that does support random access for example MemoryStream. See the Example: Convert .NET Framework to Windows Runtime random-access stream.