简体   繁体   中英

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

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示例

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).

在此处输入图片说明

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 .

阻止财富的例子 财富服务器示例

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:

在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.

在QtCreator中构建和运行项目

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM