original_docstring: 
          Receive ping from the socket.
          
docstring: Receive ping from the socket.
docstring_tokens: Receive ping from the socket .
code: def receive_pong(self, sock, ID, timeout):
          """
          Receive ping from the socket.
          """
          time_remaining = timeout
          while True:
              start_time = time.time()
              readable = select.select([sock], [], [], time_remaining)
              time_spent = (time.time() - start_time)
              if readable[0] == []: # Timeout
                  return
       
              time_received = time.time()
              recv_packet, addr = sock.recvfrom(1024)
              icmp_header = recv_packet[20:28]
              type, code, checksum, packet_ID, sequence = struct.unpack(
                  "bbHHh", icmp_header
              )
              if packet_ID == ID:
                  bytes_In_double = struct.calcsize("d")
                  time_sent = struct.unpack("d", recv_packet[28:28 + bytes_In_double])[0]
                  return time_received - time_sent
       
              time_remaining = time_remaining - time_spent
              if time_remaining <= 0:
                  return
code_tokens: def receive_pong ( self , sock , ID , timeout ) : time_remaining = timeout while True : start_time = time . time ( ) readable = select . select ( [ sock ] , [ ] , [ ] , time_remaining ) time_spent = ( time . time ( ) - start_time ) if readable [ 0 ] == [ ] : return time_received = time . time ( ) recv_packet , addr = sock . recvfrom ( 1024 ) icmp_header = recv_packet [ 20 : 28 ] type , code , checksum , packet_ID , sequence = struct . unpack ( "bbHHh" , icmp_header ) if packet_ID == ID : bytes_In_double = struct . calcsize ( "d" ) time_sent = struct . unpack ( "d" , recv_packet [ 28 : 28 + bytes_In_double ] ) [ 0 ] return time_received - time_sent time_remaining = time_remaining - time_spent if time_remaining <= 0 : return
short_docstring: Receive ping from the socket.
short_docstring_tokens: Receive ping from the socket .
comment: """
          Receive ping from the socket.
          """$SEP$# Timeout