Results 1 to 5 of 5

Thread: TCP Protocol Implementation

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default TCP Protocol Implementation

    So I need to send data between a server and client over TCP inside a vehicle. Currently, I have the server up and running but just need to figure out the actual implementation of the data transfer. For the client I need to do the same and figure out how to render the QML correctly. Anyway, what would be a good way to pass data containing QML models or even data such as Artist, Song, and Album (think iPod menu) and then also pass data regarding the song currently playing (song updates like time playing, etc.).

    Any ideas about a good way of implementing a protocol to handle this? Basically the center stack is the server and handles the logic while the cluster/client is just a view that renders QML. I was thinking about just passing QStringLists with model information and then dynamically swapping models within the view. Also, I need to send images over TCP while the song is playing for things like Album art.

    Also, I need an effective way to cache these images and probably the models too, so the client doesn't need to make a request to the server on every menu switch. Again, think about how an iPod works and that's what I'm going for.

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

    Default Re: TCP Protocol Implementation

    Why did you choose for a server and client based solution? Are you planning for multiple clients?

    I would run a sql database on the server and let the client(s) be the graphical interface.
    You can copy and store the images on the client side, but if the network connection is sufficiently fast (10 or 100 Mb/s), that wouldn't make a lot of difference, especially if the images are small. I guess these would load fast enough over the network. Did you test this? Did you have negative experiences with this?

  3. #3
    Join Date
    Aug 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: TCP Protocol Implementation

    The reason I decided to go with a client-server application was because the client represents the dashboard HMI in the vehicle and the server would be the center console. I also had never really thought about just using a SQLite database on the center stack, however. I'm not sure this would satisfy my requirements though. The dashboard HMI (screen next to speedometer and gauges) needs to have as little logic as possible. The reason for this is so it doesn't have to be flashed constantly (basically changing the server portion changes the client). So that's why I kinda' went with just passing model data around. And this is very fast because it's all done through ethernet. At first I thought about HTTP but I'd still have to implement the server using TCP so I might as well just do the whole architecture in pure TCP.

    I have most of it implemented; now I just need to come up with a message passing scheme. Also, I am looking at having multiple clients. So you can control the in-vehicle systems from the driver seat or someone in the back on an iPad can change the radio, etc; but this isn't necessarily a requirement.

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

    Default Re: TCP Protocol Implementation

    Have a look at QXmlStreamReader and Writer.
    Assuming you don't need a lot of security, you basically set up a simple server and client, then use the stream reader and writer to pass data to each other.
    That way you don't have to reinvent anything.

    Edit 1: However this will not work well for image data. You will need to encode/decode the image data (base64, ...)
    Edit 2: If you use Linux, you can also use DBus.
    Last edited by tbscope; 26th August 2012 at 20:40.

  5. #5
    Join Date
    Aug 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: TCP Protocol Implementation

    I will need to send image data for album art but I will check into encoding it. Also, is this an efficient way of sending updates every second when the QTimer event fires?

Similar Threads

  1. protocol design
    By walito in forum Newbie
    Replies: 5
    Last Post: 21st January 2011, 22:27
  2. [ASK] QT with TCP protocol in windows??
    By aribriant in forum Newbie
    Replies: 1
    Last Post: 29th September 2010, 13:47
  3. SSL protocol
    By tpthyd in forum Qt Programming
    Replies: 1
    Last Post: 2nd March 2009, 12:53
  4. Protocol Implementation. ?
    By dheeraj in forum Qt Programming
    Replies: 32
    Last Post: 9th May 2008, 10:26
  5. Signalling Protocol
    By mahe2310 in forum Qt for Embedded and Mobile
    Replies: 7
    Last Post: 16th February 2006, 05:31

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.