// Successfully loged in, status_code should be 225
+ // Perform delete operation until there is no RR or we have performed it 10 times.
+ int count = 0;
+ string delete_reply, reply_code;
+ ostringstream delete_request;
+ delete_request << "DELRR " << get_hostname() << " A " << endl;
+ do
+ {
+ // Send delete request
+ if (connection->send_data(delete_request.str()))
+ return -1;
+ // Get delete reply
+ delete_reply = connection->receive_data();
+ if ( delete_reply.empty() )
+ return -1;
+ count++;
+ reply_code = Util::parse_status_code(delete_reply);
+ }while ( (count < 10) && (reply_code != "300") );
+
+
// Send update request
ostringstream update_request;
- update_request << "ADDRR " << get_hostname() << " NS " << ip << endl;
+ update_request << "ADDRR " << get_hostname() << " A " << ip << endl;
if (connection->send_data(update_request.str()))
return -1;
// Receive update request server reply
string update_reply = connection->receive_data();
- if ( server_greeting.empty() )
+ if ( update_reply.empty() )
return -1;
else
{
// Get the return code out of the received data
- string status_code = Util::parse_status_code(login_reply);
+ string status_code = Util::parse_status_code(update_reply);
if ( status_code != "795" )
{
get_logger()->print_undefined_protocol_error("ODS",update_reply);