diff --git a/simple_message/include/simple_message/socket/simple_socket.h b/simple_message/include/simple_message/socket/simple_socket.h index bbca8701..c1c1c0f0 100644 --- a/simple_message/include/simple_message/socket/simple_socket.h +++ b/simple_message/include/simple_message/socket/simple_socket.h @@ -144,7 +144,12 @@ class SimpleSocket : public industrial::smpl_msg_connection::SmplMsgConnection /** * \brief Constructor */ - SimpleSocket(){} + SimpleSocket() + { + this->setSockHandle(this->SOCKET_FAIL); + memset(&this->sockaddr_, 0, sizeof(this->sockaddr_)); + this->setConnected(false); + } /** * \brief Destructor diff --git a/simple_message/src/socket/tcp_socket.cpp b/simple_message/src/socket/tcp_socket.cpp index f6d2f132..ae550997 100644 --- a/simple_message/src/socket/tcp_socket.cpp +++ b/simple_message/src/socket/tcp_socket.cpp @@ -52,16 +52,10 @@ namespace tcp_socket { TcpSocket::TcpSocket() -// Constructor for UDP socket object { - this->setSockHandle(this->SOCKET_FAIL); - memset(&this->sockaddr_, 0, sizeof(this->sockaddr_)); - this->setConnected(false); - } TcpSocket::~TcpSocket() -// Destructor for UDP socket object // Closes socket { LOG_DEBUG("Destructing TCPSocket"); diff --git a/simple_message/src/socket/udp_socket.cpp b/simple_message/src/socket/udp_socket.cpp index fc393e7a..95ebc5c9 100644 --- a/simple_message/src/socket/udp_socket.cpp +++ b/simple_message/src/socket/udp_socket.cpp @@ -53,13 +53,9 @@ namespace udp_socket UdpSocket::UdpSocket() // Constructor for UDP socket object { - this->setSockHandle(this->SOCKET_FAIL); - memset(&this->sockaddr_, 0, sizeof(this->sockaddr_)); memset(&this->udp_read_buffer_, 0, sizeof(this->udp_read_buffer_)); udp_read_head_ = this->udp_read_buffer_; udp_read_len_ = 0; - this->setConnected(false); - } UdpSocket::~UdpSocket()