Thread: Client for MPD
View Single Post
  #16 (permalink)  
Old 03-09-2008, 10:46 AM
mamuen mamuen is offline
Knows the basics
 
Join Date: Mar 2008
Location: germany, Heidelberg
Posts: 88
Default

Hi brathbone,

Thanke you for your interest. I have check it at
http://mpd.wikia.com/wiki/MusicPlaye...rotocolOutline

There you can read:
"The client transmits a command sequence, terminated by a newline."
"Each server response ends with a completion code. There are two codes: OK and ACK."

My problem is now, the prog. reads only about 33600 bytes not the whole stream.
By the next trasmitted newline the prog. will receive the rest.


Sub Globals
'Declare the global variables here.
Dim bufferbits(0) As byte
End Sub

Sub App_Start
Form1.Show
End Sub

Sub btnSetSRV_Click
bit.New1
client.New1
client.Connect ("192.168.200.1",6600)
stream.New1(client.GetStream,false)
Do While client.DataAvailable = false
Loop
Dim bufferbits(128) As byte
count = stream.ReadBytes(bufferbits(),128)
buffer = bit.BytesToString(bufferbits(),0,count)
txtAntwort.Text = buffer
Label5.Text = "Connected to 192.168.200.1:6600"
Form2.Show
End Sub

Sub btnSend_Click
stream.WriteBytes (stream.StringToBytes(txtBefehl.Text & Chr(10)) )
timer1.Enabled = true
End Sub

Sub Timer1_Tick
If client.DataAvailable = true Then
Dim bufferbits(102400) As byte
count = stream.ReadBytes(bufferbits(),102400)
buffer = bit.BytesToString(bufferbits(),0,count)
buffer = StrReplace (buffer,Chr(10),crlf) 'linefeed to crlf
txtAntwort.Text = buffer
txtcount.Text = count
End If
timer1.enabled = false
txtBefehl.Focus
End Sub

Sub btnExit_Click
client.Close
AppClose
End Sub



Best wishes, Mamuen
Reply With Quote