Cocos2d-x Network Programming Connect PHP Server Note 1

Source: Internet
Author: User
Tags php server dedicated server

Learning Cocos2d-x Network programming is a very embarrassing problem, because the familiar cocos2d-x learners basic in the game development a piece belongs to the client programming, want to self-study network programming necessary involved to the server this piece. But the question is, who would? Leaving the server, that network programming is undoubtedly mirage. Official Website Example Although there is an example of HTTP short connection and socket long connection but anyway I looked after selves here, do not understand how to use it in practical problems. Online tutorials are mostly generalities, not some people do not know that the sermon is part of the code can not be run, there is no way to teach you how to achieve the article. Hand-Tour server with the technology we are not likely to know very well, it is said that long-connected with the socket or Java, the short connection of the Phthon with more, of course, there is a dedicated server framework like Firefly, but it can not learn the cost of learning will be, a short time to master it is not likely to be worth when ( The general game companies want to make fast money can not give you time to learn, we are learning cocos2d-x client, not the server programmer.

Now our goal is clear, want to grasp how cocos2d-x interacts with the server, at least how to respond to the server, how to deal with the data returned by the server. We need to build one of the simplest servers. Here we implement a simple user name login server to verify the user name and password function bar. Server technology uses PHP+MYSQL technology. Why use PHP? Don't ask me why, because I only found the online ready to run the full PHP server tutorial, previously our company with Python written server, running very stable, but the problem is, no one taught me ah ...

Server Build-up:

Build PHP server from scratch or trouble, to download the PHP package and Apache to download the installation of MySQL database also have a variety of configurations, I am the most hated environment configuration or something, especially the server network environment is involved in this piece, We are not familiar with the accidentally a place is not good that is the whole lose and no one to teach you, you are there to consume it. It won't be long before the project manager will come over and scold you for not having made progress for half a day. I have met n times this sad situation. Now I am not so stupid, people's energy is limited I do not want to 1.1 points from the details of what does not belong to my good range of east. Want to build PHP server is it, online has long been ready tools: phpstudy, Integrated apache+php+mysql+phpmyadmin+ ..., anyway, you want to help you integrate well, all you have to do is double-click Setup to the next step, What configuration you do not care, it all help you to match, and absolutely effective, very good. If you want to know the specific installation, please see here: Phpstudy installation

It looks like this when it's installed:

The installation process will specify your site directory, which is what you write. php file storage location, these. php files will be server programs in the future. I put under the d:/phpwww, the name is ugly, but it does not matter, in the "Other options menu" There are port settings, be careful not to conflict with other programs, or will not be connected to the server, in addition to the MySQL server password settings and so on. There is MySQL manager, you can open a MySQL front-end, you can directly in the new Database data table, very convenient, point to other Options menu inside the configuration at a glance, here I don't say more, try it yourself. You see that both Apache and MySQL servers are in the boot state, and then try to enter the URL in your browser: http://127.0.0.1/phpinfo.php (depending on the files in your site directory), if you can open like this, it means that your php+ Apache server is built!!


So what editor do we use to write PHP files? With Notepad too tired accidentally on the grammatical error, we are not familiar with PHP syntax, wrong grammar but to kill the dead. Recommended here with Phpdesigner 8, very good, Baidu search Phpdesigner 8 registration Code A large heap, such as Phpdesigner 8 cracked, is said to be able to debug, we download the installation try it

In the next section, we will learn how to write a PHP server program.

Cocos2d-x Network Programming Connect PHP Server Note 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.