Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- server_args = ['whatsappServer', '8875']
- client1_args = ['whatsappClient', 'client1', '127.0.0.1', '8875']
- client2_args = ['whatsappClient', 'client2', '127.0.0.1', '8875']
- def main():
- server = subprocess.Popen(server_args,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- universal_newlines=True,
- bufsize=0)
- c1 = subprocess.Popen(client1_args,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- universal_newlines=True,
- bufsize=0)
- c2 = subprocess.Popen(client2_args,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- universal_newlines=True,
- bufsize=0)
- c1.stdin.write('send client2 hello')
- print(server.stdout.readline())
- print(server.stdout.readline())
- print(server.stdout.readline())
- server.stdin.close()
- c1.stdin.close()
- c2.stdin.close()
- server.stdout.close()
- c1.stdout.close()
- c2.stdout.close()
- if __name__ == '__main__':
- main()
Add Comment
Please, Sign In to add comment