Package xnap.plugin.nap.net.msg.server

Examples of xnap.plugin.nap.net.msg.server.MessageStream


    {
  if (server.getLocalPort() == 0) {
      throw new IOException(Plugin.tr("Both parties firewalled"));
  }

        MessageStream ms = new MessageStream(server);
  MessageHandler.subscribe(ErrorMessage.TYPE, ms);

        server.send(new AltDownloadRequestMessage(sr.getUser().getName(),
              sr.getFilename()));
View Full Code Here


    {
  String ip = "";
  int port = 0;

  BrowseSocket bs = null;
        MessageStream ms = new MessageStream(server);

  MessageHandler.subscribe(DirectBrowseAckMessage.TYPE, ms);
        MessageHandler.subscribe(DirectBrowseErrorMessage.TYPE, ms);

        server.send(new DirectBrowseRequestMessage(getUser().getName()));
 
  // wait for ack
  IOException e = null;
        long startTime = System.currentTimeMillis();
        while (true) {
      long timeLeft = SERVER_TIMEOUT - (System.currentTimeMillis()
                - startTime);

      if (timeLeft <= 0) {
    e = new IOException("server timeout");
    break;
      }

      if (ms.hasNext(100)) {
    ServerMessage msg = ms.next();
   
    if (msg instanceof DirectBrowseErrorMessage) {
        DirectBrowseErrorMessage m = (DirectBrowseErrorMessage)msg;
        if (m.nick.equals(getUser().getName())) {
      e = new IOException(m.message);
View Full Code Here

TOP

Related Classes of xnap.plugin.nap.net.msg.server.MessageStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.