I would like send via TCP files from PC. I use asyncstreams with prefix. I write received tcp file like here
The problem is when I try send bigger files (over for example 20 MB) .... Then my b4a app crashers, o doin'g nothing ...
If I send smaller files below 20 MB there will work great for me ... but ... what with bigger files ? Any idea what I do wrong ?
B4X:
Sub tcpsrv_NewConnection (Successful As Boolean, NewSocket As Socket)
If Successful Then
ToastMessageShow("Connected", False)
lbRek1.Text = "receiving file..."
socket1 = NewSocket
AStreams.InitializePrefix(socket1.InputStream, False, socket1.OutputStream, "AStreams")
Else
ToastMessageShow(LastException.Message, True)
End If
serverTcp.Listen
End Sub
Sub AStreams_Terminated
lbRek1.Text = "File received succesfully!"
End Sub
Sub AStreams_NewData (Buffer() As Byte)
WriteFile( File.DirRootExternal&"/mkbootloader/", "ala.avi", Buffer )
End Sub
Sub WriteFile(Dir As String, FileName As String, data() As Byte)
Dim out As OutputStream
out = File.OpenOutput(Dir, FileName, True)
out.WriteBytes(data, 0, data.Length )
out.Close
End Sub
The problem is when I try send bigger files (over for example 20 MB) .... Then my b4a app crashers, o doin'g nothing ...
If I send smaller files below 20 MB there will work great for me ... but ... what with bigger files ? Any idea what I do wrong ?