Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import socket
- import sys
- import json
- def loop(connection):
- while True:
- data = json.loads(connection.recv(1024))
- if data != 'exit':
- print data
- else:
- print 'Quitting.'
- break
- # set IP and port
- host = '127.0.0.1'
- port = 9006
- connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- connection.connect((host, port))
- loop(connection)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement