Пример #1
0
 public void listenUDP(EndPoint localEp) {
   UdpConnection connection = new UdpConnection();
   logger_.debug("Starting to listen on " + localEp);
   try {
     connection.init(localEp.getPort());
     endPoints_.add(localEp);
   } catch (IOException e) {
     logger_.warn(LogUtil.throwableToString(e));
   }
 }
Пример #2
0
  public void sendUdpOneWay(Message message, EndPoint to) {
    EndPoint from = message.getFrom();
    if (message.getFrom().equals(to)) {
      MessagingService.receive(message);
      return;
    }

    UdpConnection connection = null;
    try {
      connection = new UdpConnection();
      connection.init();
      connection.write(message, to);
    } catch (IOException e) {
      logger_.warn(LogUtil.throwableToString(e));
    } finally {
      if (connection != null) connection.close();
    }
  }