Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. BeagleBone Black: Qt 5.3 fails to send datagrams in UDP
Forum Updated to NodeBB v4.3 + New Features

BeagleBone Black: Qt 5.3 fails to send datagrams in UDP

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Morix Dev
    wrote on last edited by
    #1

    I cross-compiled Qt 5.3 for BeagleBone Black (running Debian Linux) and I am trying to send some datagrams to broadcast via UDP.

    Here is my code:

    @ #include <QCoreApplication>
    #include <QUdpSocket>
    #include <QDebug>

    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
        QUdpSocket socket;
    
        QByteArray d = QString("Hello, world!").toLatin1();
        int r = socket.writeDatagram(d, QHostAddress::Broadcast, 1111);
    
        qDebug() << r;
        qDebug() << socket.error();
        qDebug() << socket.errorString();
    
        return a.exec&#40;&#41;;
    }@
    

    Unluckily it does not work and the output of the program is:

    @-1
    QAbstractSocket::NetworkError
    "Unable to send a message"@

    So the writeDatagram primitive fails. The same exact code works perfectly fine when compiled for my desktop PC... So I am assuming that the code is good and probably there is something specifically related to BBB.

    I also tried to send the datagram to a specific IP address (instead of broadcast) but it does not change: BBB seems to be not able to send UDP packets at all...

    Any ideas about that? Is there something to be configured on BBB for letting this work?

    /Morix

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stukdev
      wrote on last edited by
      #2

      Have you check the ip of the bbb?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Morix Dev
        wrote on last edited by
        #3

        Here is my BBB network setup:

        debian@arm:/home/root$ ip addr
        1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
        valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host
        valid_lft forever preferred_lft forever
        2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP ql
        en 1000
        link/ether 1c:ba:8c:da:47:78 brd ff:ff:ff:ff:ff:ff
        inet 192.168.79.13/24 brd 255.255.255.255 scope global eth0
        valid_lft forever preferred_lft forever
        inet6 fe80::1eba:8cff:feda:4778/64 scope link
        valid_lft forever preferred_lft forever
        3: usb0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOW
        N qlen 1000
        link/ether 56:08:c7:ca:c0:44 brd ff:ff:ff:ff:ff:ff
        inet 192.168.7.2/30 brd 192.168.7.3 scope global usb0
        valid_lft forever preferred_lft forever

        It seems good to me... Am I wrong?

        /Morix

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Morix Dev
          wrote on last edited by
          #4

          It seems that on Linux you have to bind on a given interface for broadcasting packets out ot if...

          You can read the full story "here":http://stackoverflow.com/questions/24866807/beaglebone-black-qt-5-3-fails-to-send-datagrams-in-udp?noredirect=1#comment38645537_24866807

          /Morix

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved