def test(bindaddr, dnslist, proxy):
	for try_cnt in xrange(4):
		if proxy:
			addrs = socket.getaddrinfo(proxy[0], 0, 0, socket.SOCK_DGRAM, socket.SOL_UDP)
			af, socktype, proto, canonname, sa = addrs[0]
			s = socks.socksocket(af, socket.SOCK_DGRAM)
			s.set_proxy(socks.SOCKS5, *proxy)
		else:
			addrs = socket.getaddrinfo("0.0.0.0", 0, 0, socket.SOCK_DGRAM, socket.SOL_UDP)
			af, socktype, proto, canonname, sa = addrs[0]
			s = socket.socket(af, socktype, proto)
		s.setblocking(False)

		try:
			r = s.sendto("\x12\x34\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00"+"\x06"+"google"+"\x03"+"com"+"\x00\x00\x01\x00\x01",
			(dnslist[0], 53) )
		except Exception as e:
			traceback.print_exc()
			#print("Send data ERROR: connection refused")
			break

		res = None

		for i in xrange(5*5):
			time.sleep(0.2)
			try:
				res = s.recvfrom(65536)
				break
			except Exception as e:
				pass

		if res is not None:
			print('Test success with proxy %s' % (proxy,))
			break
		else:
			print((proxy,) % 'Test failure with proxy %s')
			s.close()

	print("Test finish")
	try:
		input()
	except Exception as e:
		pass
dataset/ETHPy150Open breakwa11/dnsproxy/test.py/test/swapped operands of `%`