Results 1 to 3 of 3

Thread: Ping from Qt Application

  1. #1
    Join Date
    May 2010
    Location
    Rousse, Bulgaria
    Posts
    25
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Ping from Qt Application

    Greetings!
    I wrote a network monitoring application with a Qt GUI. On Windows it's running fine (via IcmpSendEcho), but on Linux opening a raw socket requires superuser privileges. At first I tried setcap cap_net_raw+ep, like ping and fping (under Archlinux those aren't setuid/setgid root, but have capabilities of opening raw sockets), but it still gives me an "Operation not permitted" when trying to open the socket. Then I tried setuid/setgit root the GUI program and it still gives me Operation not permitted. Is there any limitation in Qt apps for using raw sockets or something else is denying the operation? Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Ping from Qt Application

    Quote Originally Posted by Axtroz View Post
    Is there any limitation in Qt apps for using raw sockets
    No. Especially since that you're not using Qt API for operating the socket.
    or something else is denying the operation? Thanks!
    Does it work if you run it as root?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2010
    Location
    Rousse, Bulgaria
    Posts
    25
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Ping from Qt Application

    Yes, it ran as root. It ran with setuid/setgit and setcap later, after I figured out that everytime I run the program from QtCreator via Run it builds and replaces the old executable with a new one without special privileges I ran it from the build folder and everything was fine.

Similar Threads

  1. Ping and QProcess (exitcode() question)
    By hakermania in forum Qt Programming
    Replies: 3
    Last Post: 30th August 2011, 23:29
  2. Replies: 3
    Last Post: 6th January 2010, 16:55
  3. Replies: 1
    Last Post: 13th November 2008, 10:46
  4. Any body who have a ping soure code using qt ?
    By longtrue in forum Qt Programming
    Replies: 1
    Last Post: 10th March 2008, 11:29
  5. How to ping a server ?
    By Nyphel in forum Newbie
    Replies: 2
    Last Post: 23rd April 2007, 11:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.