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. Host QT TCP Server
Forum Updated to NodeBB v4.3 + New Features

Host QT TCP Server

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 767 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.
  • D Offline
    D Offline
    Debson
    wrote on 15 Jul 2019, 13:27 last edited by
    #1

    Hi,

    I have understanding how to create TCP server, client and communicate between them. Unfortunately I can't find an answer on how can I host my TCP server so it can be accessed by any computer in the Internet running my client app. Is there any tutorial that shows how to host a QT TCP server(e.g. on Digital Ocean)? Can I just change TCP server IP to my Digital Ocean server's IP, upload TCP server executable and run it on the Digital Ocean server or it's a big misconception?

    Thanks.

    J 1 Reply Last reply 15 Jul 2019, 13:32
    0
    • D Debson
      15 Jul 2019, 13:27

      Hi,

      I have understanding how to create TCP server, client and communicate between them. Unfortunately I can't find an answer on how can I host my TCP server so it can be accessed by any computer in the Internet running my client app. Is there any tutorial that shows how to host a QT TCP server(e.g. on Digital Ocean)? Can I just change TCP server IP to my Digital Ocean server's IP, upload TCP server executable and run it on the Digital Ocean server or it's a big misconception?

      Thanks.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 15 Jul 2019, 13:32 last edited by
      #2

      @Debson No, your understanding is correct. You need to deploy your server part to your server and run it there. Your clients need to know the server IP (and port) to be able to connect. Make sure the firewall on the server is not blocking the port where your server app is listening for connections.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • D Offline
        D Offline
        Debson
        wrote on 15 Jul 2019, 13:47 last edited by
        #3

        That's great. Thank you so much for that answer.
        Since I have created this topic I have one more question. Is it a common practise for applications that need to access data stored on a server side(in SQL file) to use TCP server/client approach?
        E.g. Chat application where TCP server redirect message sent by one client to another client.
        Maybe there is a different approach for this type of applications that I'm not aware of?

        Thanks

        J 1 Reply Last reply 15 Jul 2019, 13:55
        0
        • D Debson
          15 Jul 2019, 13:47

          That's great. Thank you so much for that answer.
          Since I have created this topic I have one more question. Is it a common practise for applications that need to access data stored on a server side(in SQL file) to use TCP server/client approach?
          E.g. Chat application where TCP server redirect message sent by one client to another client.
          Maybe there is a different approach for this type of applications that I'm not aware of?

          Thanks

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 15 Jul 2019, 13:55 last edited by jsulm
          #4

          @Debson Well, yes you have to use TCP/IP if you want to communicate over network. Often databases are hidden behind an REST API, so the applications do not use SQL directly but this interface to access data in databases. Reason is that exposing SQL servers to the Internet is a bad idea because of security issues these server often have.
          "Maybe there is a different approach for this type of applications that I'm not aware of?" - see https://en.wikipedia.org/wiki/Peer-to-peer for an alternative approach.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          4
          • D Offline
            D Offline
            Debson
            wrote on 15 Jul 2019, 14:30 last edited by
            #5

            Its means that if I want to keep database of users and their data it will be better, more secure and common way to access that information through REST API from HTTP server instead of using sockets for communication?

            J 1 Reply Last reply 15 Jul 2019, 14:34
            0
            • D Debson
              15 Jul 2019, 14:30

              Its means that if I want to keep database of users and their data it will be better, more secure and common way to access that information through REST API from HTTP server instead of using sockets for communication?

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 15 Jul 2019, 14:34 last edited by
              #6

              @Debson I would say yes. But my understanding was that you wanted to expose SQL database directly to the Internet. This is what you should not do. You can use sockets to communicate between client and server to have a "light" interface as REST is based on HTTP and brings some overhead.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              5

              1/6

              15 Jul 2019, 13:27

              • Login

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