#include <fstream>
 #include <iostream>
+#include <limits>
 
 #include <boost/assert.hpp>
 #include <boost/foreach.hpp>
     LinkDownIntervalCmdDesc( "How long the link must be offline in order to consider it down." ),
     HostNameCmdStr( "host.name" ),
     HostNameCmdDesc( "Host address" ),
+    DefaultHostPort( 80 ), // HTTP port
+    HostPortCmdStr( "host.port" ),
+    HostPortCmdDesc( "Host port number" ),
     DefaultHostIntervalInSec( 60 ), // 60 seconds
     HostIntervalCmdStr( "host.interval" ),
     HostIntervalCmdDesc( "Interval between each ping to the host" )
         ( LinkUpIntervalCmdStr.c_str(), value<int>()->default_value( DefaultLinkUpIntervalInMin ), LinkUpIntervalCmdDesc.c_str() )
         ( LinkDownIntervalCmdStr.c_str(), value<int>()->default_value( DefaultLinkDownIntervalInMin ), LinkDownIntervalCmdDesc.c_str() )
         ( HostNameCmdStr.c_str(), value< vector<string> >(), HostNameCmdDesc.c_str() )
+        ( HostPortCmdStr.c_str(), value< vector<int> >(), HostPortCmdDesc.c_str() )
         ( HostIntervalCmdStr.c_str(), value< vector<int> >(), HostIntervalCmdDesc.c_str() )
     ;
 
         vector<string> hosts_names = vm[ HostNameCmdStr ].as< vector<string> > ();
         BOOST_FOREACH( string host_name, hosts_names )
         {
+            BOOST_ASSERT( !host_name.empty() );
+
             HostItem host_item( new Host( host_name ) );
             hosts_list.push_back( host_item );
 
         BOOST_ASSERT( hosts_names_count >= static_cast<size_t>( host_down_limit ) );
     }
 
+    // [host] port
+    size_t host_port_count = 0;
+    if ( vm.count( HostPortCmdStr ) > 0 )
+    {
+        HostList hosts_list = Config.get_hosts();
+        HostList::iterator hosts_it = hosts_list.begin();
+
+        vector<int> hosts_ports = vm[ HostPortCmdStr ].as< vector<int> >();
+        BOOST_FOREACH( int host_port, hosts_ports )
+        {
+            BOOST_ASSERT( ( 0 <= host_port ) && ( host_port <= numeric_limits<uint16_t>::max() ) );
+
+            HostItem host_item = *hosts_it;
+            host_item->set_port( static_cast<uint16_t>(host_port) );
+            ++hosts_it;
+
+            GlobalLogger.info() <<  HostPortCmdStr << "=" << host_port << endl;
+        }
+
+        host_port_count = hosts_ports.size();
+    }
+
     // [host] interval
     size_t hosts_interval_count = 0;
     if ( vm.count( HostIntervalCmdStr ) > 0 )
         HostList hosts_list = Config.get_hosts();
         HostList::iterator hosts_it = hosts_list.begin();
 
-        vector<int> hosts_intervals = vm[ HostIntervalCmdStr ].as< vector<int> > ();
+        vector<int> hosts_intervals = vm[ HostIntervalCmdStr ].as< vector<int> >();
         BOOST_FOREACH( int host_interval_in_sec, hosts_intervals )
         {
+            BOOST_ASSERT( 0 < host_interval_in_sec );
+
             HostItem host_item = *hosts_it;
             host_item->set_interval_in_sec( host_interval_in_sec );
             ++hosts_it;
         return false;
     }
 
+    BOOST_ASSERT( hosts_names_count == host_port_count );
     BOOST_ASSERT( hosts_names_count == hosts_interval_count );
 
     return true;