Example #1
0
def main():
    gateway = Gateway(SocketWrapper('localhost', 3000))
    while True:
        message = Message()
        message.type = 'request'
        message.destination = 'time_server'
        message.tag = 0
        message.data = None
        gateway.send(message)
        print gateway.recv()
def main():
    gateway = Gateway(SocketWrapper("localhost", 3000))
    gateway.register_server("time_server")
    while True:
        request = gateway.recv()
        response = Message()
        response.type = "response"
        response.destination = request.destination
        response.tag = request.tag
        response.data = str(datetime.now())
        gateway.send(response)