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. UI start QTcpSocket::listen invalid

UI start QTcpSocket::listen invalid

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 281 Views
  • 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.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by sonichy
    #1

    I have made a file server base on QTcpSocket, it can work fine.
    https://github.com/sonichy/QtFileServer/
    替代文字
    But after I move it into ui to start, it has no response and no error.
    https://github.com/sonichy/HTYServer
    替代文字

    https://github.com/sonichy

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      You are another victim of the awful fortuneclient/server examples. The community tried to make a better example for tcp comunication using Qt, you can find it on the qt wiki

      1. You are leaking every single QSocket
      2. QThread doesn't work that way. QThread in not the thread, it's a wrapper around the thread that lives in the thread that spaned it. All slots of a QThread subclass will be executed in the main thread
      3. You are formatting an html document as a response to your client. Does your gui handle them, what is it supposed to do

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      sonichyS 1 Reply Last reply
      4
      • VRoninV VRonin

        You are another victim of the awful fortuneclient/server examples. The community tried to make a better example for tcp comunication using Qt, you can find it on the qt wiki

        1. You are leaking every single QSocket
        2. QThread doesn't work that way. QThread in not the thread, it's a wrapper around the thread that lives in the thread that spaned it. All slots of a QThread subclass will be executed in the main thread
        3. You are formatting an html document as a response to your client. Does your gui handle them, what is it supposed to do
        sonichyS Offline
        sonichyS Offline
        sonichy
        wrote on last edited by
        #3

        @VRonin I move the content of QThread into mainwindow.cpp, it worked now !

        https://github.com/sonichy

        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