XML-RPC. (Điều này là một phần của hành vi của SimpleXMLRPCServer, không phải là một phần của XML-RPC bản thân.) Đó là hữu ích bởi vì những phương pháp này không có nghĩa là để cung cấp chức năng riêng biệt cho bên ngoài, nhưng có cấu trúc mã. | 522 CHAPTER 27 PROJECT 8 FILE SHARING WITH XML-RPC XML-RPC. This is part of the behavior of SimpleXMLRPCServer not a part of XML-RPC itself. That is useful because these methods aren t meant to provide separate functionality to an outside party but are there to structure the code. For now let s just assume that _handle takes care of the internal handling of a query checks whether the file exists at this specific Node fetches the data and so forth and that it returns a code and some data just as query itself is supposed to. As you can see from the listing if code OK then code data is returned immediately the file was found. However what should query do if the code returned from _handle is FAIL Then it must ask all other known Nodes for help. The first step in this process is to add to history. Note Neither the operator nor the append list method has been used when updating the history because both of these modify lists in place and you don t want to modify the default value itself. If the new history is too long query returns FAIL along with an empty string . The maximum length is arbitrarily set to 6 and kept in the global constant MAX_HISTORY_LENGTH. WHY IS MAX_HISTORY_LENGTH SET TO 6 The idea is that any peer in the network should be able to reach another in at most six steps. This of course depends on the structure of the network which peers know which but is supported by the hypothesis of six degrees of separation which applies to people and who they know. For a description of this hypothesis see for example Wikipedia s article on six degrees of separation http wiki Six_degrees_of_separation . Using this number in your program may not be very scientific but at least it seems like a good guess. On the other hand in a large network with many nodes the sequential nature of your program may lead to bad performance for large values of MAX_HISTORY_LENGTH so you might want to reduce it if things get slow. If history isn t too long the next .