Italian SOS UDP

MAX_SV

Active Member
Licensed User
Longtime User
Devo inviare da un app dei dati via UDP ...
Evento scatenato da click pulsante

B4X:
Sub cmdSend_Click
    If bConnected = False Then
        Error("Errore connessione", "Server non inizializzato.")
        Return
    End If
    
    UDP_Send(UDPSocket1, txtSend.text , txtIPAddress.Text, txtPort.text)
End Sub

richiama udp_send

B4X:
Sub UDP_Send(socketa As UDPSocket, command As String, ipaddress As String, port As String)
    Dim Packet As UDPPacket
    Dim data() As Byte
    data = command.GetBytes("UTF8")
    Packet.Initialize(data, ipaddress, port)
    socketa.Send(Packet)

    'Log(Packet)
End Sub

il problema che non esce nulla .... dove sbaglio? ho integrato la ricezione e li nessun problema
Qualcuno mi può suggerire come risolvere?
Grazie
 

MAX_SV

Active Member
Licensed User
Longtime User
A prima vista il codice MI sembra corretto. Non hai postato l'inizializzazione di UDPSocket1, che quindi dovresti verificare (dovrai usare più di un socket? Altrimenti potresti non passarlo alla routine ed usarlo direttamente).

Sicuro che la ricezione sia corretta?
inizializzo il socket all'atto della connessione (click pulsante)

B4X:
UDPSocket1.Initialize("UDP", txtPort.text, txtBufferSize.text)
    bConnected = UDPSocket1.IsInitialized
   
    If bConnected = True Then
        lblStatus.Text = MyLan.GetMyIP & "-Status: UDP attivo..."
    Else
        lblStatus.Text = MyLan.GetMyIP & "-Status: UDP Errore..."
    End If
    Activity.Title = "UDP pronto"
 

MAX_SV

Active Member
Licensed User
Longtime User
Ho testato la trasmissione con wireshark e confermo che la ricezione funziona alla perfezione mentre la trasmissione risulta nulla, non ho traffico in uscita dal device android
 

MAX_SV

Active Member
Licensed User
Longtime User
Forse vedo la luce in fondo al tunnel :) ..... adesso funziona però ... avendo cambiato router devo capire se era lui che bloccava la porta .... comunque posso continuare :)
 
Top