Results 1 to 7 of 7

Thread: create udp server for non Qt client

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default create udp server for non Qt client

    My project requires writing a UDP server in Qt for NonQt clients.
    In examples I read all are tell how to implement server and client both in Qt.
    Please guide me how to go about.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: create udp server for non Qt client

    Quote Originally Posted by kalyanakumarr View Post
    My project
    we wont do your homework...
    requires writing a UDP server in Qt for NonQt clients.
    In examples I read all are tell how to implement server and client both in Qt.
    Please guide me how to go about.
    Isn't UDP server telling by its own that the server and the client coresponding via UDP? And I have never heard that UDP is Qt only.

  3. #3
    Join Date
    Oct 2010
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: create udp server for non Qt client

    In the implementation of server by QUdpSocket based examples we are creating ByteArray buffer object, then use QDataStream device object with write only and passing the ByteArray, then we are setting version of QDataStream, then use << operator to send the data which is of type double to the ByteArray buffer. Then we are calling the writedatagram by passing ByteArray buffer, host address and port number.
    The doubt to be clarified (not to do my homwork) is will a non qt application understand the byte order done by QDataStream? Thanks in advance.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 268 Times in 268 Posts
    Wiki edits
    20

    Default Re: create udp server for non Qt client

    Quote Originally Posted by kalyanakumarr View Post
    The doubt to be clarified (not to do my homwork) is will a non qt application understand the byte order done by QDataStream? Thanks in advance.
    QDataStream is Qt specific. If you have a non Qt program, you need to implement the QDataStream structure in that application.

    However, you do not need to use QDataStream.

  5. #5
    Join Date
    Oct 2010
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: create udp server for non Qt client

    Quote Originally Posted by tbscope View Post
    QDataStream is Qt specific. If you have a non Qt program, you need to implement the QDataStream structure in that application.

    However, you do not need to use QDataStream.
    Thanks a lot. I understood now that without using QDataStream itself this could be achived. Directly fill the QByteArray object and then pass the same to writedatagram function. Thanks a lot for sharing your experience.

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: create udp server for non Qt client

    Well, since your other program will be receiving the data anyway, why not just try? You will quickly work out if you can parse the packets or whether you need to design your own QDataStream.

  7. #7
    Join Date
    Oct 2010
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: create udp server for non Qt client

    We wrote the functions to write each type of the data(both common type and struct) in to a charArray in terms of the bytes based on pointer arithmetics.
    Use the Qt Udp function calls which takes char Array and its size.
    The Program worked fine.

    For confirming the data is sent or not we used the tcpdump utility.

    Thanks a lot.

Similar Threads

  1. TCP Client / Server
    By bmarsden in forum Qt Programming
    Replies: 4
    Last Post: 8th October 2010, 10:18
  2. tcp QT server - .Net c# client
    By soniaerm in forum Qt Programming
    Replies: 0
    Last Post: 21st April 2010, 22:15
  3. Client Server
    By electronicboy in forum General Programming
    Replies: 3
    Last Post: 29th October 2009, 10:10
  4. Dual TCP/IP Client/Server
    By jimroos in forum Qt Programming
    Replies: 1
    Last Post: 29th June 2007, 21:58
  5. client-server how?
    By nongentesimus in forum Newbie
    Replies: 6
    Last Post: 28th November 2006, 09:25

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.