Java HTTP Port Find parseHostPort(String s)

Here you can find the source of parseHostPort(String s)

Description

parse Host Port

License

Open Source License

Declaration

public static InetSocketAddress parseHostPort(String s) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.net.InetSocketAddress;

public class Main {
    public static final int DEFAULT_PORT = 13543;

    public static InetSocketAddress parseHostPort(String s) {
        String[] split = s.split(":", 2);
        int port = DEFAULT_PORT;
        if (split.length == 2) {
            try {
                port = Integer.parseInt(split[1]);
            } catch (NumberFormatException ex) {
            }/* ww  w .  jav a 2 s.com*/
        }

        return new InetSocketAddress(split[0], port);
    }
}

Related

  1. isTcpPortOpenCallable(final int port)
  2. loadStringSupportedType(String javaType)
  3. parse(final String desc, final int defaultPort)
  4. parse(String specs, int defaultPort)
  5. parseCommaDelimitedHosts2(String hosts, int port_range)
  6. parsePort(String s)
  7. ping(String domain, int port)
  8. pingServer(String host, Integer port)
  9. randomAvailablePort()