Package ants.p2p.query

Examples of ants.p2p.query.ServerInfo


                                             String line) {
            try {
                //Only accept numeric addresses.  (An earlier version of this
                //did not do strict checking, possibly resulting in HTML in the
                //gnutella.net file!)
                ServerInfo si = null;
                final int DEFAULT = 443;
                int j = line.indexOf(":");
                if (j < 0) {
                  si = new ServerInfo("",line, new Integer(DEFAULT),"");
                }
                else if (j == 0) {
                  throw new IllegalArgumentException();
                }
                else if (j == (line.length() - 1)) {
                  si = new ServerInfo("",line.substring(0, j), new Integer(DEFAULT),"");
                }
                else {
                  String hostname = line.substring(0, j);
                  int port = DEFAULT;
                  try {
                    port = Integer.parseInt(line.substring(j + 1));
                  }
                  catch (NumberFormatException e) {
                    throw new IllegalArgumentException();
                  }
                  if (port < 0 || port > 65535) {
                    throw new IllegalArgumentException("invalid port");
                  }
                  si = new ServerInfo("",hostname, new Integer(port),"");
                }
                ArrayList al = new ArrayList();
                al.add(si);
                BootstrapServerManager.instance().propertyChangeSupport.firePropertyChange("inetAddressQueryCompleted", null, al);
                responses++;
View Full Code Here


                //did not do strict checking, possibly resulting in HTML in the
                //gnutella.net file!)
                String[] splittedLine = completeLine.split("[|]");
                if(splittedLine[0].equalsIgnoreCase("H")){
                  String line = splittedLine[1];
                  ServerInfo si = null;
                  final int DEFAULT = 443;
                  int j = line.indexOf(":");
                  if (j < 0) {
                    si = new ServerInfo("", line, new Integer(DEFAULT), "");
                  }
                  else if (j == 0) {
                    throw new IllegalArgumentException();
                  }
                  else if (j == (line.length() - 1)) {
                    si = new ServerInfo("", line.substring(0, j), new Integer(DEFAULT),
                                        "");
                  }
                  else {
                    String hostname = line.substring(0, j);
                    int port = DEFAULT;
                    try {
                      port = Integer.parseInt(line.substring(j + 1));
                    }
                    catch (NumberFormatException e) {
                      throw new IllegalArgumentException();
                    }
                    if (port < 0 || port > 65535) {
                      throw new IllegalArgumentException("invalid port");
                    }
                    si = new ServerInfo("", hostname, new Integer(port), "");
                  }
                  ArrayList al = new ArrayList();
                  al.add(si);
                  BootstrapServerManager.instance().propertyChangeSupport.
                      firePropertyChange("inetAddressQueryCompleted", null, al);
View Full Code Here

TOP

Related Classes of ants.p2p.query.ServerInfo

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.