public boolean open(String addr, int port, String bindAddr) {
    try {
      ssdpMultiSock = new MulticastSocket(null);
      ssdpMultiSock.setReuseAddress(true);
      InetSocketAddress bindSockAddr = new InetSocketAddress(port);
      ssdpMultiSock.bind(bindSockAddr);
      ssdpMultiGroup = new InetSocketAddress(InetAddress.getByName(addr), port);
      ssdpMultiIf = NetworkInterface.getByInetAddress(InetAddress.getByName(bindAddr));
      ssdpMultiSock.joinGroup(ssdpMultiGroup, ssdpMultiIf);
    } catch (Exception e) {
      Debug.warning(e);
      return false;
    }

    return true;
  }
 public boolean send(String msg, String bindAddr, int bindPort) {
   try {
     MulticastSocket msock;
     if ((bindAddr) != null && (0 < bindPort)) {
       msock = new MulticastSocket(null);
       msock.bind(new InetSocketAddress(bindAddr, bindPort));
     } else msock = new MulticastSocket();
     DatagramPacket dgmPacket = new DatagramPacket(msg.getBytes(), msg.length(), ssdpMultiGroup);
     // Thnaks for Tho Beisch (11/09/04)
     msock.setTimeToLive(4);
     msock.send(dgmPacket);
     msock.close();
   } catch (Exception e) {
     Debug.warning(e);
     return false;
   }
   return true;
 }
 public SSDPPacket receive() {
   byte ssdvRecvBuf[] = new byte[SSDP.RECV_MESSAGE_BUFSIZE];
   SSDPPacket recvPacket = new SSDPPacket(ssdvRecvBuf, ssdvRecvBuf.length);
   recvPacket.setLocalAddress(getLocalAddress());
   try {
     ssdpMultiSock.receive(recvPacket.getDatagramPacket());
     recvPacket.setTimeStamp(System.currentTimeMillis());
   } catch (Exception e) {
     // Debug.warning(e);
   }
   return recvPacket;
 }
  public boolean close() {
    if (ssdpMultiSock == null) return true;

    try {
      ssdpMultiSock.leaveGroup(ssdpMultiGroup, ssdpMultiIf);
      ssdpMultiSock = null;
    } catch (Exception e) {
      // Debug.warning(e);
      return false;
    }

    return true;
  }