def _listen_to_server(s, channel): print "listening on channel %s" % channel try: client.listen(_respond_to_shares, (s, channel)) except( client.ConnectionError, client.HandShakeError, client.SubscriptionError, client.ShareError ): # something went wrong, shut everything down global terminate terminate = True print "something went wrong connecting to the share server!" raise
def run_uploader(): while True: listen(50011)
# 'conn' to be in the game client = client.Client(sys.argv[1], int(sys.argv[2])) print 'Conectando ao servidor...' if client.connected(): print 'OK!' else: print 'Nao ha espaco livre no servidor' sys.exit() # initialize chat chat = Chat(client) print 'Sincronizando...' if client.synced(): client.listen(tank, enemy, chat) # init and show screen pygame.init() screen = pygame.display.set_mode(size) # load object heart = pygame.transform.scale(pygame.image.load("images/heart-icon.png"), (20, 20)) while True: for event in pygame.event.get(): if event.type == pygame.QUIT: