Attempting to read the Shoutcast stream using inet.
I connect ok, I receive streams.
But I can't get anything from "GetChunk"
Is it a way to find out what has been sent and received???

Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim txt
Dim vtData
Dim bdone
    Select Case State
    Case icResolvingHost
        txt = "1. Resolving Host"
    Case icHostResolved
        txt = "2. Host Resolved"
    Case icConnecting
        txt = "3. Connecting"
    Case icConnected
        txt = "4. Connected"
    Case icRequesting
        txt = "5. Requesting"
    Case icRequestSent
        txt = "6. Request Sent"
    Case icReceivingResponse
        txt = "7. Receiving Response"
    Case icResponseReceived
On Error GoTo closeit
        txt = "8. Response Received"
'        vtData = Inet1.GetChunk(512)
'        vtData = Inet1.GetChunk(1024, icString)
        DoEvents
        txt = txt & vtData
'        Do While Not bDone
'            strData = strData & vtData
            ' Get next chunk.
'            vtData = Inet1.GetChunk(1024, icString)
            DoEvents
'            If Len(vtData) = 0 Then
'                bDone = True
'            End If
'        Loop
    Case icDisconnecting
        txt = "9. Disconnecting"
    Case icDisconnected
        txt = "10. Disconnected"
    Case icError
        txt = "11. Error"
    Case icResponseCompleted
        txt = "12. Response Completed"
    End Select
    Text1.Text = Text1.Text & Chr(13) & Chr(10) & txt
    Exit Sub
closeit:
    Inet1.cancel
End Sub

Recommended Answers

All 8 Replies

I strongly believe that your Inet1 object variable is not instantiated to invoke the methode GetChunk.
If you have done, see that the Object is created Globally so that your function Inet1_StateCanged() can access it.

An easy methode I will tell you.

The moment you place the period(dot) after the Inet1 if GetChunk is visible as a methode there is nothing wrong with your code. your Inet1 has to draw the chunk from the stream.

bye bye

Hi,

Dont Check In "icResponseReceived" State , Check in
"icResponseCompleted" State.
Shift the whole code in Select statemnet from 8 to 12

Regards
Veena

If you check in icResponseCompleted state you are likely to lose the beginning of the stream.

Inet is instanciated, and the method is invoked at design time.

Correct: doing it on icresponsereceived will miss large part of the message: shoutcast issues a small metadata at connection (which I can't get), then the song as a single long MP3!
So I tend to use winsock, lower level.
My question is more "how can I find out waht inet (winsock) PUTS and RECEIVES (in binary format, raw data), on the net?"

Inet is instanciated, and the method is invoked at design time.

see inet and inet1 are two things.
my question is whether inet1 is instanciated or not.
If yes, whether it is globally done?
if again yes, when you type the period after inte1 is it showing the methode GetChunk ?

Yes!

Between line 23 and 24 just insert a MsgBox ( at line 24 after the first capture!)

MsgBox "I got first 512 bytes"

run the program.
If the program popups "I got first 512 bytes"
get back to me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.