Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // get stream object from wcf service
- int fileid = 1;
- Stream wcfDownload = wcfFileService.Download(fileid);
- public static void SimpleListenerExample(string prefix)
- {
- string prefix = "http://localhost:8080/index/";
- // Create a listener.
- HttpListener listener = new HttpListener();
- // Add the prefixes.
- listener.Prefixes.Add(prefix);
- listener.Start();
- // Note: The GetContext method blocks while waiting for a request.
- HttpListenerContext context = listener.GetContext();
- HttpListenerRequest request = context.Request;
- // Obtain a response object.
- HttpListenerResponse response = context.Response;
- // Construct a response.
- byte[] buffer = System.Text.Encoding.UTF8.GetBytes(wcfDownload);
- // Get a response stream and write the response to it.
- response.ContentLength64 = buffer.Length;
- System.IO.Stream output = response.OutputStream;
- output.Write(buffer,0,buffer.Length);
- // Close output stream
- output.Close();
- listener.Stop();
- }
- // Would this be the correct method of accessing the stream?
- MediaElement.Source = prefix; // at http://localhost:8080/index/
Advertisement
Add Comment
Please, Sign In to add comment