

import zmq


def main():
    """ main method """

    serverip = '79.98.29.93'
    serverport = '9092'

    ctx = zmq.Context()
    s = ctx.socket(zmq.SUB)
    s.connect('tcp://' + serverip + ':' + serverport)
    s.setsockopt(zmq.SUBSCRIBE, b'')    # subscribe to everything

    print("Entering main loop.")
    while True:
        reply = s.recv()
        reply = reply[::-1] # obelisk sent little-endian
        data = ':'.join(hex(x)[2:] for x in reply)
        print(serverip, data)

    # We never get here but clean up anyhow
    s.close()
    ctx.term()


if __name__ == "__main__":
    main()



import zmq


def main():
    """ main method """

    servers = ['preacher.veox.pw:9092']

    context = zmq.Context()
    s = context.socket(zmq.SUB)
    s.connect('tcp://' + servers[0])
    s.setsockopt(zmq.SUBSCRIBE, b'')    # subscribe to everything

    print("Entering main loop.")
    while True:
        reply = s.recv()
        reply = reply[::-1] # obelisk sent little-endian
        data = ':'.join(hex(x)[2:] for x in reply)
        print(servers[0], data)

    # We never get here but clean up anyhow
    s.close()
    context.term()


if __name__ == "__main__":
    main()

Put servers in a list, use FQDNs if available, rename context var.
Put servers in a list, use FQDNs if available, rename context var.

  
  
  import zmq
  
  
  def main():
      """ main method """
  
+     servers = ['preacher.veox.pw:9092']
-     serverip = '79.98.29.93'
-     serverport = '9092'
  
-     ctx = zmq.Context()
+     context = zmq.Context()
-     s = ctx.socket(zmq.SUB)
+     s = context.socket(zmq.SUB)
-     s.connect('tcp://' + serverip + ':' + serverport)
+     s.connect('tcp://' + servers[0])
      s.setsockopt(zmq.SUBSCRIBE, b'')    # subscribe to everything
  
      print("Entering main loop.")
      while True:
          reply = s.recv()
          reply = reply[::-1] # obelisk sent little-endian
          data = ':'.join(hex(x)[2:] for x in reply)
-         print(serverip, data)
+         print(servers[0], data)
  
      # We never get here but clean up anyhow
      s.close()
-     ctx.term()
+     context.term()
  
  
  if __name__ == "__main__":
      main()
  
Put servers in a list, use FQDNs if available, rename context var.
## Code Before:


import zmq


def main():
    """ main method """

    serverip = '79.98.29.93'
    serverport = '9092'

    ctx = zmq.Context()
    s = ctx.socket(zmq.SUB)
    s.connect('tcp://' + serverip + ':' + serverport)
    s.setsockopt(zmq.SUBSCRIBE, b'')    # subscribe to everything

    print("Entering main loop.")
    while True:
        reply = s.recv()
        reply = reply[::-1] # obelisk sent little-endian
        data = ':'.join(hex(x)[2:] for x in reply)
        print(serverip, data)

    # We never get here but clean up anyhow
    s.close()
    ctx.term()


if __name__ == "__main__":
    main()

## Instruction:
Put servers in a list, use FQDNs if available, rename context var.
## Code After:


import zmq


def main():
    """ main method """

    servers = ['preacher.veox.pw:9092']

    context = zmq.Context()
    s = context.socket(zmq.SUB)
    s.connect('tcp://' + servers[0])
    s.setsockopt(zmq.SUBSCRIBE, b'')    # subscribe to everything

    print("Entering main loop.")
    while True:
        reply = s.recv()
        reply = reply[::-1] # obelisk sent little-endian
        data = ':'.join(hex(x)[2:] for x in reply)
        print(servers[0], data)

    # We never get here but clean up anyhow
    s.close()
    context.term()


if __name__ == "__main__":
    main()
