I need to receive a file PDF from a PC. Use Asyncstream.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The sending is done to unequal packages of about 8 KB
Unfortunately, the AStreams_Terminated and/or AStreams_DataCompleted events are never called.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Thanks in advance
			
			
			
				B4X:
			
		
		
		AStreams.Initialize(Socket1.InputStream,Socket1.OutputStream,"Astreams")Unfortunately, the AStreams_Terminated and/or AStreams_DataCompleted events are never called.
			
				B4X:
			
		
		
		Sub AStreams_Terminated
    LogColor("END (Terminated)",Colors.Green )
End Sub
Sub AStreams_DataComplete
    LogColor("END (DataComplete)",Colors.Green )
End Sub
			
				B4X:
			
		
		
		Sub AStreams_NewData (Buffer() As Byte)
   Dim msg                As String
  Dim sf                   As StringFunctions
   sf.initialize
    msg = BytesToString(Buffer, 0, Buffer.Length, "ASCII")
    ric=sf.Left(msg,4)
    If ric="%PDF" Then
         ' OK
         LogColor("START PDF",Colors.Cyan)   
    End If
    If sf.InString(msg,Chr(10))>0 Then 
        ' this happens 4 or 5 times and not once
        LogColor("END PDF",Colors.Cyan)
    End IfThanks in advance
 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		