FACT++  1.0
template<class T>
tcp::endpoint StateMachineFAD< T >::GetEndpoint ( const string &  base)
inline

Definition at line 1966 of file fadctrl.cc.

References kRed.

1967  {
1968  const size_t p0 = base.find_first_of(':');
1969  const size_t p1 = base.find_last_of(':');
1970 
1971  if (p0==string::npos || p0!=p1)
1972  {
1973  T::Out() << kRed << "GetEndpoint - Wrong format ('host:port' expected)" << endl;
1974  return tcp::endpoint();
1975  }
1976 
1977  tcp::resolver resolver(StateMachineAsio<T>::get_io_service());
1978 
1979  boost::system::error_code ec;
1980 
1981  const tcp::resolver::query query(base.substr(0, p0), base.substr(p0+1));
1982  const tcp::resolver::iterator iterator = resolver.resolve(query, ec);
1983 
1984  if (ec)
1985  {
1986  T::Out() << kRed << "GetEndpoint - Couldn't resolve endpoint '" << base << "': " << ec.message();
1987  return tcp::endpoint();
1988  }
1989 
1990  return *iterator;
1991  }
Set color Red.
Definition: WindowLog.h:17