UniSet  2.8.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 
43  static bool check( const std::string& _ip, int _port, timeout_t tout ) noexcept;
44 
46  static bool check( const std::string& iaddr, timeout_t tout ) noexcept;
47 
48 
53  static bool ping( const std::string& _ip, timeout_t tout = 1000, const std::string& ping_argc = "-c 1 -w 0.1 -q -n" ) noexcept;
54  };
55  // -------------------------------------------------------------------------
56 } // end of uniset namespace
57 // -----------------------------------------------------------------------------
58 #endif // TCPCheck_H_
59 // -----------------------------------------------------------------------------
Definition: CommonEventLoop.h:14
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:83
static bool check(const std::string &_ip, int _port, timeout_t tout) noexcept
Definition: TCPCheck.cc:40