virtual ~IPService() {};
- virtual int connect(const std::string& _hostname, const std::string& _port) = 0;
+ virtual void connect(const std::string& _hostname, const std::string& _port) = 0;
virtual std::string read_from_socket() = 0;
/**
+ * Default Constructor.
+ */
+NetHelper::NetHelper()
+ : Log(new Logger())
+{
+ IPService::Ptr _ip_service_ptr(new TCPService());
+ IPServicePtr.swap(_ip_service_ptr);
+}
+
+
+/**
* Constructor.
* @param _log Logger
- * @param _host Host
- * @param _port Port
*/
NetHelper::NetHelper( const Logger::Ptr _log )
: Log(_log)
typedef boost::shared_ptr<NetHelper> Ptr;
+ NetHelper();
+
NetHelper(const Logger::Ptr _log);
~NetHelper();
/**
* Initiate a new session with the peer.
* @param endpoint_iterator The enpoint iterator.
- * @return 0 if all is fine, throws boost::syste::system_error if something went wrong.
+ * @return throws boost::syste::system_error if something went wrong.
*/
-int TCPService::connect(const std::string& _host, const std::string& _port) throw (boost::system::system_error)
+void TCPService::connect(const std::string& _host, const std::string& _port) throw (boost::system::system_error)
{
// Init boost::system::error_code
boost::system::error_code error_code;
if ( error_code )
throw boost::system::system_error(error_code);
- return 0;
+ return;
}
public:
- typedef boost::shared_ptr<TCPService> Ptr;
+ //typedef boost::shared_ptr<TCPService> Ptr;
TCPService();
~TCPService();
- virtual int connect(const std::string& _hostname, const std::string& _port) throw (boost::system::system_error);
+ virtual void connect(const std::string& _hostname, const std::string& _port) throw (boost::system::system_error);
std::string read_from_socket() throw (boost::system::system_error);