bsiilvia
bsiilvia

Reputation: 97

How to connect Server with Client using c++ on QT creator and gui?

I need to create a connection between a Server and a Client using c++ but with a GUI. I choose to use Qt Creator but I see variuos type of guides and anything help me to understand some things. So, do you know a valid guide or tutorial can help me? Because I didn't write any line of code because I don't know also how to start... So please Someone can help me? thanks

Upvotes: 1

Views: 3987

Answers (1)

Mr. Developerdude
Mr. Developerdude

Reputation: 9648

Step 1: Open QtCreator

I assume you already have sucessfully installed QtCreator. Start it up :-)

Step 2: Open the examples

In QtCreator you have a lot of examples that come with the software and is immediately available to test out! All you have to do is open the examples screen and find the example you want. Each example is accompanied with a lot of well written documentation.

QtCreator Examples

Step 3: Search for "network"

In your case you want examples related to network programming. Simply type network in the search field (or anything else you want).

enter image description here

Step 4: Select the example you want

Actually since you wanted to make a client and a server you will want to look at two separate examples called blocking fortune client and fortune server.

Blocking fortune example Fortune server example

Step 5: Configure the examples

When you click the example, QtCreator will ask you to configure the example. This simply means you have to choose which "kit" to compile the project with. This is a side-effect of the awesome fact that Qt supports a lot of platforms and a lot of versions. In your case there should probably be only one or two options. The screen looks like this:

Configuring a project in QtCreator

Step 6: Build and run the project

I would start the server first and then start the client. They should be able to communicate over network. Please consult the excellent documentation that pops up for each example to find out how it is bestto test them.

In general, to run a project, simply select the correct project/kit/build/run from the selector (see screenshot) and then press the big green play symbol. This should take some time to build and then start your example.

Build and run project in QtCreator

There, I hope this got you going on a journey in the world of the really amazing Qt & QtCreator tools!

Upvotes: 1

Related Questions