helper.h 496 B

123456789101112131415
  1. #pragma once
  2. #include <util/generic/string.h>
  3. #include <util/datetime/base.h>
  4. namespace NCoro {
  5. // @brief check that address `host`:`port` is connectable
  6. bool TryConnect(const TString& host, ui16 port, TDuration timeout = TDuration::Seconds(1));
  7. // @brief waits until address `host`:`port` became connectable, but not more than timeout
  8. // @return true on success, false if timeout exceeded
  9. bool WaitUntilConnectable(const TString& host, ui16 port, TDuration timeout);
  10. }