return shared_ptr<Pinger>(
                 new TcpPinger( io_serv, tcp_raw_protocol::v4(), network_interface, ping_reply_timeout_in_sec )
         );
+    case PingProtocol_TCP_IPv6:
+        return shared_ptr<Pinger>(
+                new TcpPinger( io_serv, tcp_raw_protocol::v6(), network_interface, ping_reply_timeout_in_sec )
+        );
     default:
         BOOST_ASSERT( !"Try to create a pinger from an invalid protocol" );
         return shared_ptr<Pinger>();
 
     protocol_string_map[ "ICMP" ] = PingProtocol_ICMP;
     protocol_string_map[ "ICMPv6" ] = PingProtocol_ICMPv6;
     protocol_string_map[ "TCP" ] = PingProtocol_TCP;
+    protocol_string_map[ "TCP_IPv6" ] = PingProtocol_TCP_IPv6;
 
     return protocol_string_map[ protocol_string ];
 }
 
     PingProtocol_ICMP = PingProtocol_First,
     PingProtocol_ICMPv6,
     PingProtocol_TCP,
-    PingProtocol_Last = PingProtocol_TCP
+    PingProtocol_TCP_IPv6,
+    PingProtocol_Last = PingProtocol_TCP_IPv6
 };
 
 PingProtocol get_ping_protocol_from_string( std::string protocol_string );
 
 ) :
     IoService( io_serv ),
     DestinationEndpoint(),
-    Socket( IoService, protocol ),
+    Protocol( protocol ),
+    Socket( IoService, Protocol ),
     NetInterface( source_network_interface_name, Socket ),
     TcpSegmentReceiveTimer( IoService ),
     Identifier( 0 ),
 
 address TcpPinger::get_source_address()
 {
-    return NetInterface.get_address( tcp_raw_protocol::v4() );
+    return NetInterface.get_address( Protocol );
 }
 
 address TcpPinger::get_destination_address() const
     uint16_t source_port = get_source_port();
     uint16_t destination_port = get_destination_port();
     TcpSegmentItem tcp_segment = TcpSegmentFactory::create_tcp_segment_ack_request(
-            tcp_raw_protocol::v4(),
+            Protocol,
             source_address, destination_address,
             source_port, destination_port, SequenceNumber );
 
         if ( bytes_sent != buffer_size( data ) )
         {
             GlobalLogger.error() << "Error: fail sending ping data."
-                    << endl;
+                    << "Amount of bytes sent differs from the buffer." << endl;
         }
     }
     catch ( const exception &ex )
         }
 
         // Decode the reply segment.
-        TcpSegmentItem tcp_segment = TcpSegmentFactory::create_tcp_segment( tcp_raw_protocol::v4(), is );
+        TcpSegmentItem tcp_segment = TcpSegmentFactory::create_tcp_segment( Protocol, is );
 
         // Filter out only the TCP reset (RST) replies. Note that the sequence
         // number from RST does not match the sent ACK's sequence number.
 
     boost::asio::io_service &IoService;
     /// the destination host
     boost::asio::ip::tcp_raw_protocol::endpoint DestinationEndpoint;
-    /// the socket object
+    /// Network layer protocol used to ping, IPv4 or IPv6
+    boost::asio::ip::tcp_raw_protocol::socket::protocol_type Protocol;
+    /// The socket object
     boost::asio::ip::tcp_raw_protocol::socket Socket;
     /// This object represents the network interface
     NetworkInterface<boost::asio::ip::tcp_raw_protocol::socket, boost::asio::ip::tcp_raw_protocol> NetInterface;
-    /// the timer of TCP segment receive, triggers the timeout to avoid infinite
+    /// The timer of TCP segment receive, triggers the timeout to avoid infinite
     /// wait
     boost::asio::deadline_timer TcpSegmentReceiveTimer;
     /// TCP packet identifier
     uint16_t Identifier;
     /// TCP packet sequence_number
     uint16_t SequenceNumber;
-    /// the time when the last ICMP packet was sent
+    /// The time when the last ICMP packet was sent
     boost::posix_time::ptime TimeSent;
-    /// the buffer where the data received will be placed
+    /// The buffer where the data received will be placed
     boost::asio::streambuf ReplyBuffer;
-    /// flag to indicate if we got a reply or not
+    /// A flag to indicate if we got a reply or not
     bool ReceivedReply;
     /// the amount of time to wait for the reply
     int RstReplyTimeoutInSec;
 
 
 #include "tcp/tcpheader.h"
 #include "tcp/tcpipv4segment.h"
-#ifdef IPV6_WORKING
 #include "tcp/tcpipv6segment.h"
-#endif
 
 using namespace std;
 using boost::asio::ip::address;
     {
         tcp_segment.reset( new TcpIpv4Segment() );
     }
-#ifdef IPV6_WORKING
     else if ( tcp_raw_protocol::v6() == protocol )
     {
         tcp_segment.reset( new TcpIpv6Segment() );
     }
-#endif
     else
     {
         BOOST_ASSERT( !"Invalid TCP Segment Type." );
                 source_address, destination_address,
                 source_port, destination_port, sequence_number );
     }
-#ifdef IPV6_WORKING
     else if ( tcp_raw_protocol::v6() == protocol )
     {
         tcp_segment = create_tcp_ipv6_segment_ack_request(
                 source_address, destination_address,
                 source_port, destination_port, sequence_number );
     }
-#endif
     else
     {
         BOOST_ASSERT( !"Invalid TCP Segment Type." );
         const uint16_t sequence_number
 )
 {
-#ifdef IPV6_WORKING
     BOOST_ASSERT( source_address.is_v6() );
     BOOST_ASSERT( destination_address.is_v6() );
 
     tcp_header.set_checksum( cksum );
 
     TcpSegmentItem tcp_segment( new TcpIpv6Segment( tcp_header ) );
-#endif
-    TcpSegmentItem tcp_segment;
+
     return tcp_segment;
 }