c++qtqtcpsocketqtcpserver

Qt Authentication users with QTcpServer (with username and password)


I want to write a chat program with login page.

I want to send request from client to server with username and password, then server receives, verifies and then responds to client.

Can anyone please guide me of what QT class should I use or can tell me some ideas of how to access them?


Solution

  • With QTcpServer, you can set up authentication for client with some basic username:password pair at the start. As soon as the connection is established, ask or wait for the username:password to be sent over to the Server. Verify it. In case of invalid data or timeout, close the connection.

    As far as the login page is concerned, you need to host that on the Server and you'll be dealing in HTTP protocol instead of TCP. Take a look at QHttp. That'll get you started.

    For Qt, there are other options too. You just have to lay down your requirements and find the one that might fulfill those e.g. Wt.