def _fire_forget_query(ip: str, query: bytes) -> bytes:
""" Connect to node, fire the query, read and disconnect. """
s = socket.create_connection(address=(ip, EPMD_DEFAULT_PORT),
timeout=EPMD_REMOTE_DEFAULT_TIMEOUT)
query1 = util.to_u16(len(query)) + query
s.send(query1)
# Expect that after everything is received, the peer will close
# the socket automatically, so we will too
result = b''
while True:
incoming = s.recv(4096)
if incoming == b'':
break
result += incoming
s.close()
return result
评论列表
文章目录