Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Host QT TCP Server
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?
@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.
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?
@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.
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?
@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.