##############################################################################if __name__ ='__main__'server eval('serversys argv[ ]client eval('clientsys argv[ ]multiprocessing process(target=serverstart(client(#import timetime sleep( client in this process server in new process reset streams in client test effect of exit flush run the test script with client and server number on the command line to test the module' toolsmessages display process id numbersand those within square brackets reflect transfer across streams connected to sockets (twicewhen nested) :\pp \internet\socketstest-socket_stream_redirect py server got [client server got [client server got [client :\pp \internet\socketstest-socket_stream_redirect py client got [server client got [server client got [server :\pp \internet\socketstest-socket_stream_redirect py client got [server got [client ]client got [server got [client ]client got [server got [client ] :\pp \internet\socketstest-socket_stream_redirect py server got [client got [server ]server got [client got [server ]server got [client got [server ] :\pp \internet\socketstest-socket_stream_redirect py server got [client got [server ]server got [client got [server ]server got [client got [server ]if you correlate this script' output with its code to see how messages are passed between client and serveryou'll find that print and input calls in client functions are ultimately routed over sockets to another process to the client functionsthe socket linkage is largely invisible text-mode files and buffered output streams before we move onthere are two remarkably subtle aspects of the example' code worth highlightingbinary to text translations raw sockets transfer binary byte stringsbut by opening the wrapper files in text modetheir content is automatically translated to text strings on input and output text-mode file wrappers are required if accessed through standard stream tools network scripting