Results 1 to 3 of 3

Thread: QTcpServer/socket readall

  1. #1
    Join Date
    Apr 2016
    Posts
    9
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default QTcpServer/socket readall

    I want to send an file over a tcp socket with base64. But when I do readAll I receive it in multiple strings.
    I know that there are a lot of topics about this but what is the best way to receive the complete data?
    Also I want to know what the best way is to send an file, with the file I also have to send some data(String). Thats the reason I use base64.

    Does someone has an example of how I can receive complete data?

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpServer/socket readall

    With TCP socket data are transfered in chunks. Every readAll gives You one chunk of data. You must defien some protocol that allows to recognize the beginning and end of data.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTcpServer/socket readall

    We've already covered that, haven't we?
    http://www.qtcentre.org/threads/6578...ver-qtcpsocket

    Cheers,
    _

Similar Threads

  1. Replies: 3
    Last Post: 9th December 2012, 20:34
  2. QTcpServer/Socket Bidrirectional Communication
    By shhtk in forum Qt Programming
    Replies: 1
    Last Post: 29th June 2011, 08:27
  3. Replies: 1
    Last Post: 5th September 2008, 11:36
  4. Replies: 2
    Last Post: 23rd June 2007, 09:13
  5. Replies: 1
    Last Post: 18th June 2006, 10:12

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.