[Reading Notes] iOS network-use Game Kit to implement inter-device communication and ioskit

Source: Internet
Author: User

[Reading Notes] iOS network-use Game Kit to implement inter-device communication and ioskit

Apple's Game Kit framework enables communication between devices without a network, including the absence of cellular services, wi-Fi infrastructure and LAN or Internet access are unavailable. For example, in the depths of the jungle, on a highway or in the basement of a building.

I. Game Kit Basics

In addition to the underlying network communication features, Game Kit also includes Game-specific technologies, such as achievements, rankings, and competitions.

Although Bluetooth has its unique advantages that do not depend on network infrastructure, it also has some major defects. The maximum connection range of 32 feet is much smaller than that of the Wi-Fi network, and the latter can cover a wider range across multiple access points. In a Wi-Fi network, the available bandwidth of each endpoint is nearly 10 times that of Bluetooth. Although Bluetooth radio is more power-saving than Wi-Fi, if all endpoints can be connected through these two types of access connections, Game Kit will still prefer Wi-Fi instead of Bluetooth. Although it is wrong to consider only one connection, it will actually reduce the overall power consumption of the device. IOS devices connected to the Wi-Fi network will use this connection for all data requests in the background, such as periodic email checks or push notifications. Because the radio will be used, using Bluetooth radio will actually increase power consumption.

All communication through Game Kit sessions is not encrypted. If the data confidentiality is very important for applications, for example, mobile payment devices transmit credit card information for registration, developers are responsible for encrypting the traffic before sending the data to GKSession.

 

Ii. Point-to-Point Network

Under the point-to-point Game Kit connection, the behavior of any endpoint in the network is both a server and a client. In many cases, the same device switches between the client and server roles during the business process. However, you can use a single P2P connection, you do not have to reconnect the device to convert it into a new role. P2P is also very suitable for the process where the endpoint role is not known before the process starts.

1. Connect to the session.

2. send data to the endpoint.

1) The ARM processor used by iOS devices uses a small byte sequence.

Large-end and small-end bytecode represent binary data sets in two ways. Large-end bytes are stored in the most important to least important order, while small-end bytes are in the opposite order. An example of the large-end bytecode is the telephone number. The number groups are arranged from the most important (Country Code) to the least important (user number. The bytecode originated from the hardware implementation of storing values in the memory, the purpose of standardizing the network's byte order is to prevent small computers from accidentally interpreting the binary data stored in the large-end byte order without knowing the need for conversion. The names of daduan and xiaoduan originated from Jonathon Swift's novel garifo travelogue, which describes two different ways to beat eggs.

 

3. client-server communication

 

Iv. Summary

Game Kit plays a unique role in the iOS ecosystem because it can be integrated with Bluetooth to create networks for nearby devices. Its Wi-Fi function is a simple encapsulation of Bonjour services. However, its real advantage is that it can use the same code base to support two network technologies. Its innovative P2P model provides unprecedented flexibility for applications to join the network, while the client-server model provides developers with a more familiar environment while improving stability.

 

Reference: iOS network advanced programming-enterprise application development for iPhone and iPad

Related Article

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.