B4R Question aStream Stack problem? [probably not solvable...]

Hans- Joachim Krahe

Active Member
Licensed User
Longtime User
... this works fine, without...

B4X:
Private Sub Server_NewConnection (NewSocket As WiFiSocket)
    Astream.Initialize(NewSocket.Stream, "astream_NewData", "astream_Error")
    Astream.WaitForMoreDataDelay = 100
End Sub

Private Sub Astream_NewData (Buffer() As Byte)
    Log("")
    Log("-------------new income buffer: ",Buffer)
    Log(" stack: ",StackBufferUsage)
 
    If bc.IndexOf(Buffer, "GET") <> -1 Then

        Public wB() As Byte = "<!DOCTYPE html PUBLIC @-//W3C//DTD XHTML 1.0 Transitional//EN@ @http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd@>"      
        astreamOut(wB)
        Public wB() As Byte = "<html xmlns=@http://www.w3.org/1999/xhtml@>"
        astreamOut(wB)
        Public wB() As Byte ="<head>"
        astreamOut(wB)
        Public wB() As Byte = "<meta content=@de@ http-equiv=@Content-Language@ />"
        astreamOut(wB)
        Public wB() As Byte ="<meta content=@de@ http-equiv=@Content-Language@ />"
        astreamOut(wB)
        Public wB() As Byte ="<meta content=@text/html; charset=utf-8@ http-equiv=@Content-Type@ />"
        astreamOut(wB)
        Public wB() As Byte ="<title>Ohne_Titel_1</title>"
        astreamOut(wB)
        Public wB() As Byte ="<style Type=@text/css@>"
        astreamOut(wB)
        Public wB() As Byte =".style1 {"
        astreamOut(wB)
        Public wB() As Byte ="margin-left: 80px;"
        astreamOut(wB)
        Public wB() As Byte ="}"
        astreamOut(wB)
        Public wB() As Byte ="</style>"
        astreamOut(wB)
        Public wB() As Byte ="</head>"
        astreamOut(wB)
        Public wB() As Byte ="<body>"
        astreamOut(wB)
        Public wB() As Byte ="<form action=@@ form method=@post@>"
        astreamOut(wB)
        Public wB() As Byte ="Name<input class=@style1@ name=@T1@ Type=@text@ value=@bla1@ /><br /><br />"
        astreamOut(wB)
        Public wB() As Byte ="Max <input class=@style1@ name=@T2@ Type=@text@ value=@bla22222@ /><br /><br />" : astreamOut(wB)
        Public wB() As Byte ="<input name=@T3@ Type=@text@ class=@style1@ value=@bla3@ /><br /><br />"
        astreamOut(wB)
        Public wB() As Byte ="Dauer<input class=@style1@ name=@T4@ Type=@text@ value=@bla4@ /><br /><br />"
        astreamOut(wB)
        Public wB() As Byte ="<button type=@submit@ formmethod=@post@>Submit using POST</button>"            '"<button class=@btn btn-lg btn-primary btn-block@ type=@submit@>Reset</button>"                        ' "<button name=@foo@ value=@upvote@>Upvote</button>@ /><br />"
        astreamOut(wB)
        Public wB() As Byte ="<button class=@btn btn-lg btn-primary btn-block@ type=@submit@>Reset</button>"                        ' "<button name=@foo@ value=@upvote@>Upvote</button>@ /><br />"
        astreamOut(wB)
        Public wB() As Byte = "<button name=@foo@ value=@upvote@>Upvote</button><br />"
        astreamOut(wB)
        Public wB() As Byte ="</form>"
        astreamOut(wB)
        Public wB() As Byte ="</body>"
        astreamOut(wB)
        Public wB() As Byte ="</html>"
        astreamOut(wB)
        CallSubPlus("CloseConnection", 200, 0)
    End If


incoming message (DNT: 1) is interrupted after 108 Byte, never mind I change text or set Astream.WaitForMoreDataDelay = 100

Disconnected
-------------new income buffer: POST / HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Referer: http://192.168.4.1/
Accept
stack: 108
-------------new income buffer: -Language: de-DE
User-Agent: Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko
Content
stack: 108
-------------new income buffer: -Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: 192.168.4.1
Content
stack: 108
-------------new income buffer: -Length: 35
DNT: 1
Connection: Keep-Alive
Cache-Control: no-cache
T1=bla1&T2=bla22222&T3=bla3&
stack: 108
-------------new income buffer: T4=bla4
stack: 15

Ican fix it by string manipulation, but why does'nt it work correct? Stack is much bigger...



thanks:)^


... additional: stack buffer = 2000, astream stops at 108 Byte...


..ok, problem seems to be structural - saw thread from 2016...
 
Last edited:

Mostez

Well-Known Member
Licensed User
Longtime User
Upvote 0
Top