public DNSOutgoing addAnswer(DNSIncoming in,InetAddress addr,int port,DNSOutgoing out,DNSRecord rec) throws IOException {
  DNSOutgoing newOut=out;
  if (newOut == null) {
    newOut=new DNSOutgoing(DNSConstants.FLAGS_QR_RESPONSE | DNSConstants.FLAGS_AA,false,in.getSenderUDPPayload());
  }
  try {
    newOut.addAnswer(in,rec);
  }
 catch (  final IOException e) {
    newOut.setFlags(newOut.getFlags() | DNSConstants.FLAGS_TC);
    newOut.setId(in.getId());
    send(newOut);
    newOut=new DNSOutgoing(DNSConstants.FLAGS_QR_RESPONSE | DNSConstants.FLAGS_AA,false,in.getSenderUDPPayload());
    newOut.addAnswer(in,rec);
  }
  return newOut;
}

public DNSOutgoing addAnswer ( DNSIncoming in , InetAddress addr , int port , DNSOutgoing out , DNSRecord rec ) throws IOException { DNSOutgoing newOut = out ; if ( newOut == null ) { newOut = new DNSOutgoing ( DNSConstants . FLAGS_QR_RESPONSE | DNSConstants . FLAGS_AA , false , in . getSenderUDPPayload ( ) ) ; } try { newOut . addAnswer ( in , rec ) ; } catch ( final IOException e ) { newOut . setFlags ( newOut . getFlags ( ) | DNSConstants . FLAGS_TC ) ; newOut . setId ( in . getId ( ) ) ; send ( newOut ) ; newOut = new DNSOutgoing ( DNSConstants . FLAGS_QR_RESPONSE | DNSConstants . FLAGS_AA , false , in . getSenderUDPPayload ( ) ) ; newOut . addAnswer ( in , rec ) ; } return newOut ; }
add an answer to a question . deal with the case when the outgoing packet overflows
