(This is a follow-up question to this one.)
I want to read an endless audio stream asynchronously, so that I can do my JIT analysis on the obtained data. Using a WebClient
object's DownloadDataAsync
method, I can initiate the download easily, see following Win form project:
Imports System.Net 'For WebClient
Public Class Form1
Private WithEvents c As New WebClient()
Protected Overrides Sub Finalize()
c.Dispose()
MyBase.Finalize()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim u As New Uri("http://flower.serverhostingcenter.com:8433/;")
c.DownloadDataAsync(u)
End Sub
Private Sub c_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles c.DownloadProgressChanged
Debug.Print(e.BytesReceived.ToString & " B received.")
End Sub
End Class
and the stream seems to flow, as per the DownloadProgressChanged
event's output to the immediate window:
2920 B received.
48180 B received.
56940 B received.
61320 B received.
87600 B received.
94900 B received.
160436 B received.
162060 B received.
227596 B received.
...
However, I lack to find a method to also read the obtained data. As this is an endless stream, DownloadDataCompleted
will never fire (nor does any other event except the one used).
How do I access the obtained data?