예제 #1
0
파일: sauron.py 프로젝트: jlzirani/pamela-1
    def handle(self, *args, **options):
        context = zmq.Context()
        socket = context.socket(zmq.REP)
        socket.bind("tcp://0.0.0.0:8000")

        while True:
            msg = socket.recv()
            print "Got", msg, "updating"
            try:
                update_macs(json.loads(msg))
                socket.send('200. OK')
            except:
                socket.send('500. Error')
                raise
예제 #2
0
import zmq, json
from pamela.views import update_macs
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://0.0.0.0:5000")

while True:
    msg = socket.recv()
    print "Got", msg, "updating"
    try:
        update_macs(json.loads(msg))
        socket.send('200. OK')
    except:
        socket.send('500. Error')
        raise