8.4. Server Software
The simple TCP server that was presented in Example 69 has a major drawback: it can serve only one client at a time. If only a few clients use the server, it is unlikely that several clients will try to connect to it simultaneously and each client will get a response without a noticeable delay. However, this approach does not scale.
Writing robust, secure and scalable server software from scratch is not easy. Fortunately, in most cases you do not have to worry about this. If you are experimenting with new ideas or you are making a prototype for a restricted number of people, you can freely use any approach that works, like the simple TCP server above. However, keep security in mind in these cases as well – a protected intranet or a correctly configured firewall keeps you safe with only little additional effort.
Remember that everything sent by TCP, HTTP or JSON is directly readable by anyone who can tap into the network you use. If you use an open or weakly encrypted WiFi network, capturing the traffic is especially straightforward. Do not rely on passwords sent over these protocols and do not assume that requests always originate from a trusted client.
PyS60 supports Secure Socket Layer (SSL) and Secure HTTP (HTTPS). These protocols are a must if you need to transfer any sensitive information. More information about these protocols can be found in the PyS60 API documentation.
If you are building a production system or you are about to release your code to ...
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.