yes, a made an mp3 player in B4J for desktop, and I want to create a remote control using a web browser to play,stop, o play next song, really simple to achieve if the B4J app can have a http server like Android appIf I understand correctly, you want example of how a client app (UI) send and/or receive data to/from a server app (non-UI).
I have Web API server and client templates and also JRDC2 server and client templates.
I don't get it.yes, a made an mp3 player in B4J for desktop, and I want to create a remote control using a web browser to play,stop, o play next song, really simple to achieve if the B4J app can have a http server like Android app
because everybody has a browser, on the pc, mac, android or iOS device, and obviously can be use over WANwhy?
it is just a easy way to let old people to listen music, without tech , just open the browser and click on play button or click next. Many people i know is feed up with complicated apps...etc.. winamp use to be simple buy can not be installed on new systems... so I decided to make my ownWhy not upload the mp3 to a server and share the link?
thank you for all your suggestionsYou can create Web frontend to load the mp3 or create B4X apps to download the files using the URLs from the server.
Sub AStream_NewData (Buffer() As Byte)
Dim txt As String = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
Dim components() As String
components = Regex.Split("\r\n",txt)
If components(0) = "GET /test HTTP/1.1" Then
Log("test")
End If
If components(0) = "GET /play HTTP/1.1" Then
Log("play")
End If
If components(0) = "GET /next HTTP/1.1" Then
Log("next")
End If
If components(0) = "GET /stop HTTP/1.1" Then
Log("stop")
End If
If components(0) = "GET /autodj HTTP/1.1" Then
Log("autodj")
Button8_Click
End If
Dim dd As String =$"HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 48
Connection: Closed
<html><body><h1>Hello, World!</h1></body></html>"$
astream.Write(dd.GetBytes("UTF8")) ' <----- it does not show nothing on the browser
astream.SendAllAndClose
End Sub
I don't know why you make it so complicated.well, I did it, but still can't send a page to the browser (i need help )
B4X:Sub AStream_NewData (Buffer() As Byte) Dim txt As String = BytesToString(Buffer, 0, Buffer.Length, "UTF8") Dim components() As String components = Regex.Split("\r\n",txt) If components(0) = "GET /test HTTP/1.1" Then Log("test") End If If components(0) = "GET /play HTTP/1.1" Then Log("play") End If If components(0) = "GET /next HTTP/1.1" Then Log("next") End If If components(0) = "GET /stop HTTP/1.1" Then Log("stop") End If If components(0) = "GET /autodj HTTP/1.1" Then Log("autodj") Button8_Click End If Dim dd As String =$"HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Content-Length: 48 Connection: Closed <html><body><h1>Hello, World!</h1></body></html>"$ astream.Write(dd.GetBytes("UTF8")) ' <----- it does not show nothing on the browser astream.SendAllAndClose End Sub