Results 1 to 5 of 5

Thread: Receive varialbe length Image Problem??

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: Receive varialbe length Image Problem??

    Hi,

    First, use a buffer to store the data from the socket.

    Into "readyRead()" method, first check if you have almost 16 bytes into the socket.
    If you have 16 bytes into the socket you can read all available bytes and store it into your buffer.
    After this you can check if the buffer size have the bytes that your header points to plus 16 bytes(header). If not, you will receive another "readyRead" signal (it's like a loop).
    When the buffer contains all the bytes you can create the image and don't forget to clear the buffer for the next receiving image.
    Òscar Llarch i Galán

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

    ganapathi (11th February 2016)

  3. #2
    Join Date
    Sep 2015
    Posts
    23
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Receive varialbe length Image Problem??

    Quote Originally Posted by ^NyAw^ View Post
    Hi,

    First, use a buffer to store the data from the socket.

    Into "readyRead()" method, first check if you have almost 16 bytes into the socket.
    If you have 16 bytes into the socket you can read all available bytes and store it into your buffer.
    After this you can check if the buffer size have the bytes that your header points to plus 16 bytes(header). If not, you will receive another "readyRead" signal (it's like a loop).
    When the buffer contains all the bytes you can create the image and don't forget to clear the buffer for the next receiving image.

    Yes this worked ....thanks a lot..

Similar Threads

  1. Problem with tcp - client receive message
    By gelman in forum Newbie
    Replies: 3
    Last Post: 25th August 2011, 14:35
  2. udp receive data problem
    By zxwmail in forum Newbie
    Replies: 9
    Last Post: 21st June 2011, 22:11
  3. Replies: 4
    Last Post: 18th August 2010, 08:13
  4. Replies: 1
    Last Post: 30th November 2007, 10:03

Tags for this Thread

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.