/**
   * Constructor - takes a datagram packet and a stack structure Extracts the address of the other
   * from the datagram packet and stashes away the pointer to the passed stack structure.
   *
   * @param stack is the shared SIPStack structure
   * @param messageProcessor is the creating message processor.
   */
  protected UDPMessageChannel(SIPTransactionStack stack, UDPMessageProcessor messageProcessor) {
    super.messageProcessor = messageProcessor;
    this.sipStack = stack;

    Thread mythread = new Thread(this);

    this.myAddress = messageProcessor.getIpAddress().getHostAddress();
    this.myPort = messageProcessor.getPort();

    mythread.setName("UDPMessageChannelThread");
    mythread.setDaemon(true);
    mythread.start();
  }
  /**
   * Constructor. We create one of these in order to process an incoming message.
   *
   * @param stack is the SIP sipStack.
   * @param messageProcessor is the creating message processor.
   * @param packet is the incoming datagram packet.
   */
  protected UDPMessageChannel(
      SIPTransactionStack stack, UDPMessageProcessor messageProcessor, DatagramPacket packet) {

    this.incomingPacket = packet;
    super.messageProcessor = messageProcessor;
    this.sipStack = stack;

    this.myAddress = messageProcessor.getIpAddress().getHostAddress();
    this.myPort = messageProcessor.getPort();
    Thread mythread = new Thread(this);
    mythread.setDaemon(true);

    mythread.start();
  }
 /**
  * Constructor. We create one of these when we send out a message.
  *
  * @param targetAddr INET address of the place where we want to send messages.
  * @param port target port (where we want to send the message).
  * @param sipStack our SIP Stack.
  */
 protected UDPMessageChannel(
     InetAddress targetAddr,
     int port,
     SIPTransactionStack sipStack,
     UDPMessageProcessor messageProcessor) {
   peerAddress = targetAddr;
   peerPort = port;
   peerProtocol = "UDP";
   super.messageProcessor = messageProcessor;
   this.myAddress = messageProcessor.getIpAddress().getHostAddress();
   this.myPort = messageProcessor.getPort();
   this.sipStack = sipStack;
   if (sipStack.isLoggingEnabled()) {
     this.sipStack.logWriter.logDebug(
         "Creating message channel " + targetAddr.getHostAddress() + "/" + port);
   }
 }