UniSet  2.6.0
TCPCheck.h
1 /*
2  * Copyright (c) 2015 Pavel Vainerman.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, version 2.1.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Lesser Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 // -----------------------------------------------------------------------------
17 #ifndef _TCPCheck_H_
18 #define _TCPCheck_H_
19 // -----------------------------------------------------------------------------
20 #include <atomic>
21 #include "ThreadCreator.h"
22 #include "PassiveTimer.h" // for timeout_t
23 // -----------------------------------------------------------------------------
24 namespace uniset
25 {
31  class TCPCheck
32  {
33  public:
34  TCPCheck() noexcept;
35  ~TCPCheck() noexcept;
36 
45  static bool check( const std::string& _ip, int _port, timeout_t tout ) noexcept;
46 
48  static bool check( const std::string& iaddr, timeout_t tout ) noexcept;
49 
50 
55  static bool ping( const std::string& _ip, timeout_t tout = 1000, const std::string& ping_argc = "-c 1 -w 0.1 -q -n" ) noexcept;
56 
57  protected:
58  };
59  // -------------------------------------------------------------------------
60 } // end of uniset namespace
61 // -----------------------------------------------------------------------------
62 #endif // _TCPCheck_H_
63 // -----------------------------------------------------------------------------
Definition: CallbackTimer.h:29
Definition: TCPCheck.h:31
static bool ping(const std::string &_ip, timeout_t tout=1000, const std::string &ping_argc="-c 1 -w 0.1 -q -n") noexcept
Definition: TCPCheck.cc:88
static bool check(const std::string &_ip, int _port, timeout_t tout) noexcept
Definition: TCPCheck.cc:49