Results 1 to 3 of 3

Thread: Network Communication Architecture

  1. #1
    Join Date
    Jan 2006
    Location
    Maui, Hawaii
    Posts
    120
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    65
    Thanked 4 Times in 4 Posts

    Default Network Communication Architecture

    I want to architect a client and a server where the server sends out data periodically and is able to receive commands. Since the clients need to be able to send commands and receive data, both the client and the server have to have the ability to read and write.

    I'm trying to find a good template to get started. It looks like the fortuneclient/fortune server example won't work because the server is not able to read anything from the client. It only detects new connections. Is that right?

    I suppose I could use QUdpSocket on both the client and the server and just use the readDatagram/writeDatagram functions to implement reading and writing. If I go down this path, would I need to use different ports for the commands to the server and the responses from the server? Also, is there an example that uses this?

    Sorry for asking such a broad question on this. Thanks in advance for whatever help may come.
    Last edited by mhoover; 29th May 2009 at 01:25. Reason: poor title

  2. #2
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    70
    Thanked 59 Times in 57 Posts

    Default Re: Network Communication Architecture

    Hi,

    I'm trying to find a good template to get started. It looks like the fortuneclient/fortune server example won't work because the server is not able to read anything from the client. It only detects new connections. Is that right?
    The server is able to recive data. Just connect "readyRead" signal to any slot. The server is the one who accepts the connection but then the communication can be done by the two ways.

    I suppose I could use QUdpSocket on both the client and the server and just use the readDatagram/writeDatagram functions to implement reading and writing. If I go down this path, would I need to use different ports for the commands to the server and the responses from the server? Also, is there an example that uses this?
    You can use QUdpSocket if you want UDP datagrams or QTcpSocket if you want to use TCP streams.
    Using UDP may become on loosing data, but imagine that you try to develop a Voice IP application that the sound have to arrive as it is sent. Then you have to play all the sound that is arriving and can't wait if there are data lost.
    On the other hand, imaginge that you send images that have to be stored. Then you need TCP because TCP implements a resending mechanism if there is data lost.

    Hope it helps.
    Òscar Llarch i Galán

  3. The following user says thank you to ^NyAw^ for this useful post:

    mhoover (30th May 2009)

  4. #3
    Join Date
    Jan 2006
    Location
    Maui, Hawaii
    Posts
    120
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    65
    Thanked 4 Times in 4 Posts

    Default Re: Network Communication Architecture

    Very helpful response. Thank you!

    I ended up using the QUdpSocket and it works great!

    Like the pikachu signature.

Similar Threads

  1. Useless but curious compiler warning question
    By Raccoon29 in forum General Programming
    Replies: 4
    Last Post: 30th July 2008, 21:46
  2. SQL Question
    By ^NyAw^ in forum Qt Programming
    Replies: 5
    Last Post: 8th April 2008, 20:36
  3. Exceptions / setjmp/longjmp question
    By Aceman2000 in forum Qt Programming
    Replies: 3
    Last Post: 13th March 2008, 18:14
  4. Replies: 1
    Last Post: 15th March 2007, 21:45

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.