QUdpSocket direct connection



  • Hi All,

    If I connect my device via a router, it works perfectly.
    If I connect directly to the computer, I get a 169.254.214.29 IP address it won't work.
    If I connect directly to the computer and manually change my IP address to 192.168.1.xxx, it works!!!
    If I connect directly to the computer and manually change my IP address to 169.254.214.29, it doesnt work.

    In ALL cases, if I look with Wireshark, it always work. I cannot event send a datagram with 169.254.214.29. Wireshark does see my datagrams being send out.

    What is happening?

    Thanks!



  • It is not a QUdpSocket issue.
    It is basic networking question.

    169.254.x.x is a link-local address range.
    A device gets an address from this range if there is no any address assignment made by admin or by dhcp.
    When you enter address manually the device gets only default route and 169.254.x.x is not part of default route.
    If you need to route 169.254.x.x then you need to create a route manually. How to do it depends on OS.
    on Linux for example
    @
    route add -net 169.254.0.0 netmask 255.255.0.0 dev eth0 metric 99
    @



  • ok! I understand.

    Do you have a CMD example for windows laying around?

    [quote author="andreyc" date="1418321135"]It is not a QUdpSocket issue.
    It is basic networking question.

    169.254.x.x is a link-local address range.
    A device gets an address from this range if there is no any address assignment made by admin or by dhcp.
    When you enter address manually the device gets only default route and 169.254.x.x is not part of default route.
    If you need to route 169.254.x.x then you need to create a route manually. How to do it depends on OS.
    on Linux for example
    @
    route add -net 169.254.0.0 netmask 255.255.0.0 dev eth0 metric 99
    @[/quote]



  • Something like this
    @
    route add 169.254.0.0 mask 255.255.0.0 192.168.0.1 metric 99
    @

    But I have not tested it.



  • I Have tried

    @route add 169.254.214.29 mask 255.255.0.0 192.168.0.1 metric 99@

    But I get

    @The route addition failed: The parameter is incorrect.@



  • I guess you need to use interface instead of router ip
    Take a look "here":http://windowsitpro.com/networking/q-when-i-add-static-ip-route-what-value-do-i-use-interface


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.