(1) HTTP-based mobile online games
Because all MIDP specifications stipulate that HTTP must be supported. According to industry insiders, China Telecom will only support HTTP in the future, therefore, many mobile online games are built on HTTP. But because of the integrity of HTTP protocol encapsulation, it brings benefits and disadvantages.
First, let's look at the advantages of http:
1: The servelt container will automatically manage the thread pool. In our program, you do not have to manage the thread on your own. Of course, the thread I am talking about is a thread generated by the client to connect to the server.
2: HTTP is secure. Session is used to manage each session, saving the headache of client impersonating.
3: almost all mobile phones supporting Java support the HTTP protocol.
Of course, there are other advantages. I can't come here one by one. Let's try it myself ......
The second is the disadvantages of the HTTP protocol:
1: the connectivity of the HTTP protocol is a headache for everyone. Someone once mentioned how to modify the HTTP protocol. I don't know if it succeeded? Of course, this is beyond the scope of our discussion.
2: It is the problem of network traffic, which is also a headache for everyone. If it is not a monthly subscription, this is indeed a large expense for users.
Next I will explain the architecture of the client and server of the famous mobile online game "fruite-Machine:
Phone --------------- → servlet ------------------ → Web Browser
The figure above shows the overall architecture of the "fruit machine.
"Fruit machine" was once popular in various video game halls and appeared as a gambling machine. This game is easy to design, but it is quite playable. It is a classic game comparable to "Tetris.
The Web browser layer behind the architecture is used to manage users' web interfaces and operate databases to manage users.
Because Users enter "username" and password "on their mobile phones during login, security is a big problem.
In the design document in fruite-machine, this problem is solved:
1. Use end-to-end encrypted connections to replace HTTP
2: Send username and password to servlet through a secure wireless gateway over HTTP.
3: Send the username and password in the same firewall as the servlet.
To solve the problem of user spoofing, a user may download the MIDlet client and modify the source code, which may send fake packets to the servlet end, in the fruit machine, some data that may be modified by the user is generated on the servlet end and then transmitted to the MIDlet, so that the user cannot modify the data. For example, the MIDlet does not generate a result that rotates immediately, but is generated by the server.