Const function and changed not needed return value from int to void.
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Mon, 17 May 2010 09:07:34 +0000 (11:07 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Mon, 17 May 2010 09:07:34 +0000 (11:07 +0200)
src/ip_service.h
src/net_helper.cpp
src/net_helper.h
src/tcp_service.cpp
src/tcp_service.h

index 6a27b91..ee0742a 100644 (file)
@@ -28,7 +28,7 @@ public:
 
     virtual std::string read_from_socket() = 0;
 
-    virtual int write_to_socket(const std::string& data) = 0;
+    virtual void write_to_socket(const std::string& data) = 0;
 
     virtual int close() = 0;
 };
index c9138f6..0050b75 100644 (file)
@@ -47,7 +47,7 @@ NetHelper::~NetHelper()
  * Open the connection to the peer.
  * @return 0 if all is fine, -1 on error.
  */
-int NetHelper::open_connection(const string& hostname, const string& port)
+int NetHelper::open_connection(const string& hostname, const string& port) const
 {
     try
     {
index 777b83a..3658ac7 100644 (file)
@@ -34,7 +34,7 @@ public:
 
     ~NetHelper();
 
-    int open_connection(const std::string& _host, const std::string& _port);
+    int open_connection(const std::string& _host, const std::string& _port) const;
 
     int send_data(const std::string& data);
 
index 907b186..0c2d635 100644 (file)
@@ -124,9 +124,9 @@ std::string TCPService::read_from_socket() throw (boost::system::system_error)
 /**
  * Writes out given data to the socket.
  * @param data The data which will be written to the socket.
- * @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::write_to_socket(const string& data) throw (boost::system::system_error)
+void TCPService::write_to_socket(const string& data) throw (boost::system::system_error)
 {
     // Get the data size which will be written
     unsigned int data_size = data.size();
@@ -146,7 +146,7 @@ int TCPService::write_to_socket(const string& data) throw (boost::system::system
     else if ( bytes_wrote != data_size )
         throw boost::system::system_error(boost::system::error_code(ENOBUFS,boost::system::system_category),"Could not write all data to the socket.");
 
-    return 0;
+    return;
 }
 
 
index b6926f5..135a6fa 100644 (file)
@@ -41,7 +41,7 @@ public:
 
     std::string read_from_socket() throw (boost::system::system_error);
 
-    int write_to_socket(const std::string& data) throw (boost::system::system_error);
+    void write_to_socket(const std::string& data) throw (boost::system::system_error);
 
     int close() throw (boost::system::system_error);
 };