Results 1 to 1 of 1

Thread: Use QUdpSocket as a QIODevice (read, readline, write)

  1. #1
    Join Date
    May 2013
    Posts
    24
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Use QUdpSocket as a QIODevice (read, readline, write)

    Hi,

    I would like to use QUdpSocket as a QIODevice (read(), readLine(), write()). In my application I want to be able to send data over UDP or RS-232 using QSerialPort (which also is a QIODevice).
    QUdpSocket's documentation state that to be able to use the udp socket as a QIODevice, connectToHost() must be called. After I called connectToHost() I can write data, but I can't read data. Calling bind doesn't help.

    I have provided a short example which displays the problem. Write some text in the line edit, press send and it shall be sent to the right textbrowser which will send a new UDP datagram that should show up in the left textbrowser. Broadcast addresses are used.

    Edit: I'm using Qt 5.2.1 on Windows 7
    Thanks!
    Attached Files Attached Files
    Last edited by salcin; 10th April 2014 at 00:10.

Similar Threads

  1. QUdpSocket & QAudioOutput & QIODevice
    By Mkhitar in forum Qt Programming
    Replies: 0
    Last Post: 3rd October 2013, 14:50
  2. use QUdpSocket as a QIODevice
    By feverzsj in forum Qt Programming
    Replies: 0
    Last Post: 19th December 2012, 05:50
  3. Missng last lines when read file wth readLine()
    By aguayro in forum Qt Programming
    Replies: 3
    Last Post: 20th August 2012, 15:07
  4. QUdpSocket with read() and write()
    By Naar Shilka in forum Qt Programming
    Replies: 0
    Last Post: 8th March 2012, 16:23
  5. Replies: 1
    Last Post: 16th June 2009, 10:09

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.