Results 1 to 3 of 3

Thread: Remake udp (SOCK_DGRAM) socket onto QUdpSocket

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Oct 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Smile Re: Remake udp (SOCK_DGRAM) socket onto QUdpSocket

    these samples based on binding of fixed port 45454.
    sender and receiver connected to each other by knowing fixed port. how about if another receiver will connect from the same computer? the port is already binded. that is. second receiver doesn't receive anything.


    Added after 1 18 minutes:


    i did it!

    ingredients:

    m_pUdpSocket = new QUdpSocket(this);
    m_pUdpSocket->connectToHost(strHost, nPort);

    method write:

    QByteArray arrBlock;
    QDataStream out(&arrBlock, QIODevice::WriteOnly);
    out.setVersion(QDataStream::Qt_4_7);
    out << (qint8)0x4C << (qint8)0x4D << (qint8)0x43 << (qint8)0x50 << (qint8)0x00 << (qint8)0x01 << (qint8)0xAA << (qint8)0xBB << (qint8)0x01 << (qint8)0x00 << (qint8)0x00;
    m_pUdpSocket->write(arrBlock);

    and slotReadyRead reacted by m_pUdpSocket, SIGNAL(readyRead()) has received Server answer on generic socket port.

    I watched all exchage in WireShark sniffer.
    Last edited by pethead; 2nd November 2010 at 07:26.

Similar Threads

  1. QUdpSocket: sending and receiving on the same socket?
    By mhoover in forum Qt Programming
    Replies: 16
    Last Post: 17th June 2009, 03:28
  2. UDP - QUdpSocket
    By denwelzie in forum Qt Programming
    Replies: 7
    Last Post: 29th April 2008, 09:02
  3. Elite remake ported to Qt
    By zelko in forum Qt-based Software
    Replies: 0
    Last Post: 17th March 2008, 00:49
  4. QUdpSocket binding
    By db in forum Qt Programming
    Replies: 0
    Last Post: 13th March 2008, 11:24
  5. Socket Programming Port53 QTcpSocket/QUdpSocket
    By patrik08 in forum General Programming
    Replies: 5
    Last Post: 10th May 2007, 16:59

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
  •  
Qt is a trademark of The Qt Company.