Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt TcpServer
Forum Updated to NodeBB v4.3 + New Features

Qt TcpServer

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 767 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    itsseven
    wrote on last edited by
    #1

    Hi All,

    I have used Qt to write a TcpServer and Python as Client.
    The connection is OK. But the transfer of string is something else. Server cant readout the String from client.
    After research, it seems that it is difficult to use a client not wrote by Qt for communication. Is this true?
    Does anyone have a good idea ?

    thanks for reply!

    K 1 Reply Last reply
    0
    • I itsseven

      Hi All,

      I have used Qt to write a TcpServer and Python as Client.
      The connection is OK. But the transfer of string is something else. Server cant readout the String from client.
      After research, it seems that it is difficult to use a client not wrote by Qt for communication. Is this true?
      Does anyone have a good idea ?

      thanks for reply!

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @itsseven

      It depends how you transfer the information. The problem with a string is its definition. Especially where the end of the string is. You cannot send a string and the other side knows exactly what to with it. With most othe data types that is different. When you send a 4 byte integer and expect one on the other side. It is easy, but also mixing of types may be a problem. When you send a double but the other side expects an integer. Therefore in most cases you have to define your interface.

      For your specific case, it may be good enough to send the number of characters to like to send first followed by the actual string. Your client will receive the number of characters and can take the required steps to allocate the memory for the string. This is the way to send string which you want toreceive as a recognized string on the other side. It basically depends on what you like to do with it. E.g. for simple display functionality it may be even good enough to send the information byte by byte and place the received byte directly on screen.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved