o
    ci                     @   sP   d dl mZ d dlmZ d dlZd dlZdefddZdeeef fddZ	dS )	    )Tuple)closingNreturnc                  C   s`   t ttjtj} | d | tjtjd |  d W  d    S 1 s)w   Y  d S )N) r      )	r   socketAF_INETSOCK_STREAMbind
setsockopt
SOL_SOCKETSO_REUSEADDRgetsockname)s r   T/home/ubuntu/.local/lib/python3.10/site-packages/ray/experimental/collective/util.pyfind_free_port   s
   

$r   c                  C   s   t j } t }| |fS )z4Returns the IP address and a free port on this node.)rayutilget_node_ip_addressr   )addrportr   r   r   get_address_and_port   s   
r   )
typingr   
contextlibr   r   r   intr   strr   r   r   r   r   <module>   s    