One question about udp

schimanski

Well-Known Member
Licensed User
Longtime User
I want to get some data from a server. It runs without problems with the following tcp-code. But I want the same to get udp-data. For me, it is not clear, how I can only read the data. Is Packet.initialize only to send data? But where can I set the IP to read the data?

B4X:
'Service module
Sub Process_Globals
  Dim Client As Socket
  Dim filestreamAusgang As AsyncStreams 
  ...
End Sub

Sub Verbindungsaufbau
  Client.Initialize("Client")
  Client.Connect ("92.199....","32001",5000)            
End Sub

Sub client_Connected (Successful As Boolean)
  If Successful Then
    filestreamAusgang.Initialize(Client.InputStream, client.OutputStream, "filestreamAusgang")
    ToastMessageShow("Connected", False)
  end if
End Sub

Sub filestreamAusgang_NewData (Buffer() As Byte)   
  UKSP_Pufferlaenge=Buffer.Length       
  UKSP_Puffer_Bytes=Buffer         
  UKSP_Server_auswerten
End Sub

Thanks for your help..



Gesendet von meinem XT910 mit Tapatalk
 
Top