Chapter 8. Mobile Networking

The modern mobile phone is a personal computer whose primary purpose is to keep its user connected with the outside world. This is where PyS60 becomes most fun: you can innovate and experiment with the most insane, amazing and productive combinations of you and others, our physical environment and all the digital information in the world.

After these grandiose motivational words, we can crawl back to the technical details. Writing distributed applications, including the ones discussed in this chapter, are more difficult to get to work right than programs that do not communicate. The reason is simple: you have to keep three independent components synchronized instead of a single program.

The client, the server and the network between them are all running independent, complex pieces of software that are only kept together by the force of protocols. In addition, with mobile phones, one of the components keeps changing all the time. Depending on your location, the network may be non-existent or anything between a low-bandwidth GSM connection to a broadband wireless LAN. Fortunately for us, a dynamic programming language, such as Python, makes it possible to adapt to changing environments with relative ease.

Even better news is that the most typical networking tasks are made really simple in PyS60. You can download anything from the web with one line of code and you can upload anything to your own website almost as easily. These basic tasks are introduced ...

Get Mobile Python: Rapid Prototyping of Applications on the Mobile Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.