Results 1 to 5 of 5

Thread: Send Image over TCP failed ??

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2015
    Posts
    23
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Send Image over TCP failed ??

    Quote Originally Posted by yeye_olive View Post

    Your TCP code suffers from the same problems as your UDP code, which I pointed out in your other thread: strange global variables such as "a" and "img_block" are being modified all over the place, the "y" counter in a for loop is modified inside the body of the loop, etc. Maybe you got it working on UDP, but I wonder how maintainable it is.

    Here is one new problem in your TCP code: you seem to assume that after you call socket->write(buffer) in the client, the server receives all this data, and only it, as one nice block, which you can read with socket->readAll(). That is not how TCP works. I strongly suggest you read http://blog.stephencleary.com/2009/0...e-framing.html to understand the problem.
    My aim is only to test the concepts than optimize it. Just get it working.

    I will go through that link and implement those solutions and let you know further .

    Thanks a lot for the link.

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

    Default Re: Send Image over TCP failed ??

    Hi,

    As yeye_olive explained, you are assuming that the full image will be received in one slot call on the client side. This is not true, so you will receive the image into blocks(data chunks).

    My aim is only to test the concepts than optimize it. Just get it working.
    This is not a optimization problem, the problem is the concept.

    Please, read the link that yeye_olive provided you.
    Òscar Llarch i Galán

Similar Threads

  1. QML Image: Failed to get image from provider
    By mismael85 in forum Qt Quick
    Replies: 1
    Last Post: 13th December 2012, 15:37
  2. How to send Image trough TCP/ip in Qt?
    By qtlinuxnewbie in forum Newbie
    Replies: 5
    Last Post: 27th April 2010, 03:21
  3. Release program failed to show jpg image on another PC!
    By bangqianchen in forum Qt Programming
    Replies: 4
    Last Post: 31st January 2010, 22:16
  4. Saving image in jpeg format failed
    By febil in forum Qt Programming
    Replies: 5
    Last Post: 23rd April 2009, 11:33
  5. Send a Image throw a QDataStream
    By gt.beta2 in forum Newbie
    Replies: 5
    Last Post: 20th March 2009, 23:07

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.