From 1dd65870293a4a3dd80f65e8c4c775a800281195 Mon Sep 17 00:00:00 2001 From: Chao Zhan <chao.zhan@fu-berlin.de> Date: Wed, 5 Jul 2023 23:52:34 +0200 Subject: [PATCH] add python exercise --- slides/pages/recap.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/slides/pages/recap.md b/slides/pages/recap.md index e308aaf..893e4ae 100644 --- a/slides/pages/recap.md +++ b/slides/pages/recap.md @@ -43,6 +43,23 @@ It is a mechanism that allows an object residing in one system (JVM) to access/i **Note:** RMI is a Java-specific implementation of RPC. +--- +title: RPC in Python +--- + +## Exercise: Using RPC in Python + +Python provides built-in support for RPC through the [xmlrpc](https://docs.python.org/3/library/xmlrpc.html) module. + +1. Try the example in `exercises/python-rpc` with your teammates. +2. Modify the example to implement RPC services that sends bytes of a file (e.g. `yourimage.jpg`) to the client. + +**Hint**: + +- Use `open` to open a file and read it in binary mode. +- Use `xmlrpc.client.Binary` to wrap the bytes. +- You can find example in the documentation of [xmlrpc](https://docs.python.org/3/library/xmlrpc.html). + --- title: P2P --- -- GitLab