Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

UDP networking with multiple network


10der
 Share

Question

@A.SochaHi!

 

Sir, as well you always ignore my requests and bugs.

Can you ignore another one, if possible,

 

 

Please login or register to see this image.

/monthly_2020_11/image.png.01318d75f75cbd576585766c20343796.png" />

 

image.png.f65acb856469a915154dba3561d95a16.png

 

image.png.e918a4c4be758803ad3c2b80828817ca.png

 

 

now I am trying to send pair command to my broadlink

 

Please login or register to see this code.

 

and this packet fly away to default for HC3 network - 192.168.1.0 / 24

but I want to route this packet to another HC3 interface with address 192.168.10.100

 

so, i can propose to add to constructor parameter "ip"

 

local udp =
    net.UDPSocket(
    {
        ip = "192.168.10.100" --  sock:setsockname(self.opts.ip or HC3.getIPaddress(), 0)
,        timeout = 5000,
        broadcast = true
    }
)
 

 

and this fix issues with multiple network interfaces and UDP packets distribution.

 

thank you very much.

 

 

Edited by 10der
  • Thanks 1
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

I haven't dealt with it yet, but is it necessary to use broadcast transmission at Broadlink?
I also haven't solved UDP on HC3 yet, but I know that there is a possibility to turn off broadcast parameters
broadcast = false.
I think he will then accept the destination ip.

For the case with broadcast = true, I would rather appreciate the addition of the parameter of the used eth / wifi interface, or use as the parameter designation network (192.168.10.0).
It's hard to say what a bug is and what a property is. Probably ... it's a feature until it is removed as a bug in the next release.

  • Thanks 1
Link to comment
Share on other sites

  • 0
  • Inquirer
  • 3 hours ago, Martin_N said:

    I think he will then accept the destination ip.

                    ^^^

    HE

    Slovak found! :) 

     

    3 hours ago, Martin_N said:

    For the case with broadcast = true, I would rather appreciate the addition of the parameter of the used eth / wifi interface, or use as the parameter designation network (192.168.10.0).

    ok! i can trying today test id BL can accept direct packet. on another hand how HC3 send packet... I am not sure what if i send packed to 192.168.10.1 HC3 what has def GW is 192.168.1.1 not trying to send this packet via this IF instead of IF 192.168.10.0

    Edited by 10der
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @Martin_Nthank you so much!

    it works

     

    local UDP_IP_PORT = 80
    local MY_IP = "192.168.10.100"
    local BROADCAST_IP = "192.168.10.1"
     
    package.path = package.path .. ";./TEST/libs/?.lua";
    package.cpath = package.cpath .. ";./TEST/libs/?.dll";
    local socket = require("socket")
     
    local udp = socket.udp()
    udp:settimeout(1)
    -- udp:setsockname(MY_IP, 0)
    -- udp:setoption("broadcast", true)
    local resultTX, errorMsg = udp:sendto(txMsg, BROADCAST_IP, UDP_IP_PORT)
    print(resultTX, errorMsg)
    local rxMsg, ipOrErrorMsg = udp:receivefrom()
    print(rxMsg, ipOrErrorMsg)
    udp:close()

    now i am trying to implemant thsi in HC3

    YAY!

     

    Please login or register to see this attachment.

    • Like 1
    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

     Share

    ×
    ×
    • Create New...