An Echo Example
This example illustrates that Python data types are preserved when they are
passed from the Echo64
client to the
Echo32
server and back. The
Echo32
server just returns a
tuple
of the (args, kwargs)
that it received back to the
Echo64
client.
Create an Echo64
object
>>> from msl.examples.loadlib import Echo64
>>> echo = Echo64()
send a boolean as an argument, see send_data()
>>> echo.send_data(True)
((True,), {})
send a boolean as a keyword argument
>>> echo.send_data(boolean=True)
((), {'boolean': True})
send multiple data types as arguments and as keyword arguments
>>> echo.send_data(1.2, {'my_list':[1, 2, 3]}, 0.2j, range(10), x=True, y='hello world!')
((1.2, {'my_list': [1, 2, 3]}, 0.2j, range(0, 10)), {'x': True, 'y': 'hello world!'})
Shutdown the 32-bit server when you are done
>>> stdout, stderr = echo.shutdown_server32()