B4J Question Ethernet vs Wifi

Discussion in 'B4J Questions' started by Blueforcer, Aug 28, 2018.

  1. Blueforcer

    Blueforcer Active Member Licensed User

    I try to send an SSDP Broadcast to my network.
    The following Code doesnt work in B4J (get no response) But it will be send (according to WireShark). My PC is connected to the same Network via EthernetCable.
    In B4A (of course wiFi) it works like a charm. Is there any known Problem to send such a broadcast message through Ethernet instead of WiFi? The devices wich should respond are also WiFi devices.


    Code:
    Public Sub Search
        udp1.Initialize(
    "UDP1"19821000)
        
    Dim sb As StringBuilder
        sb.Initialize
        sb.Append(
    "M-SEARCH * HTTP/1.1").Append(Chr(13) & Chr(10))
        sb.Append(
    "HOST: 239.255.255.250:1982").Append(Chr(13) & Chr(10))
        sb.Append(
    "MAN: " & Chr(34) & "ssdp:discover" & Chr(34)).Append(Chr(13) & Chr(10))
        sb.Append(
    "ST: wifi_bulb").Append(Chr(13) & Chr(10))
        
    Dim package As UDPPacket
        package.Initialize(sb.ToString.GetBytes(
    "UTF8"),"239.255.255.250",1982)
        udp1.Send(package)
    End Sub

    Sub UDP1_PacketArrived (Packet As UDPPacket)
        
    Log(Packet.toString)
    End Sub
     
    Last edited: Aug 28, 2018
  2. Erel

    Erel Administrator Staff Member Licensed User

    It doesn't matter whether it is a wifi or ethernet connection.

    What is the output of Log(udp1.GetBroadcastAddress)?
     
  3. Blueforcer

    Blueforcer Active Member Licensed User

    That's exactly what I thought, but I can't explain this behaviour.

    udp1.GetBroadcastAddress gives
    "192.168.178.255"
    and thats correct.
     
    Last edited: Aug 28, 2018
  4. OliverA

    OliverA Expert Licensed User

  5. Blueforcer

    Blueforcer Active Member Licensed User

    No, according to Yeelight Specs:
    anyway, it works over WiFi but not over Ethernet.
     
  6. OliverA

    OliverA Expert Licensed User

    When you are on WiFi, are all the devices you reach also on WiFi? Do both WiFi and Ethernet have the same network? Could it be possible that your router blocks broadcasting from Ethernet to WiFi and/or vice versa?
     
  7. Blueforcer

    Blueforcer Active Member Licensed User

    Yeah sure, i also can control the wifi devices with TCP.

    A friend said that there is no one who forward a broadcasts message, so an ethernet broadcast can only go to Ethernet devices. Same with Wifi
     
  8. OliverA

    OliverA Expert Licensed User

    inakigarm likes this.
  9. Blueforcer

    Blueforcer Active Member Licensed User

    And thats the problem, my router does not have such a setting. if I use an WifiStick on my PC it also works in B4J.
    So i search the devices via nmap now. not what i want, but it works.
    So for all Others:
    Its not possible to send a Broadcast from an ethernet device to wifi devices out of the box. The client will never recieve it.
    Wifi to Wifi works
     
    Harris and inakigarm like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice