Package java.net

Examples of java.net.Inet4Address


  public static TeredoInfo getTeredoInfo(Inet6Address ip) {
    Preconditions.checkArgument(isTeredoAddress(ip),
        "Address '%s' is not a Teredo address.", ip.getHostAddress());

    byte[] bytes = ip.getAddress();
    Inet4Address server = getInet4Address(copyOfRange(bytes, 4, 8));

    int flags = ByteStreams.newDataInput(bytes, 8).readShort() & 0xffff;

    // Teredo obfuscates the mapped client port, per section 4 of the RFC.
    int port = ~ByteStreams.newDataInput(bytes, 10).readShort() & 0xffff;

    byte[] clientBytes = copyOfRange(bytes, 12, 16);
    for (int i = 0; i < clientBytes.length; i++) {
      // Teredo obfuscates the mapped client IP, per section 4 of the RFC.
      clientBytes[i] = (byte) ~clientBytes[i];
    }
    Inet4Address client = getInet4Address(clientBytes);

    return new TeredoInfo(server, client, port, flags);
  }
View Full Code Here


  public static TeredoInfo getTeredoInfo(Inet6Address paramInet6Address)
  {
    Preconditions.checkArgument(isTeredoAddress(paramInet6Address), "Address '%s' is not a Teredo address.", new Object[] { toAddrString(paramInet6Address) });
    byte[] arrayOfByte1 = paramInet6Address.getAddress();
    Inet4Address localInet4Address1 = getInet4Address(Arrays.copyOfRange(arrayOfByte1, 4, 8));
    int i = ByteStreams.newDataInput(arrayOfByte1, 8).readShort() & 0xFFFF;
    int j = (ByteStreams.newDataInput(arrayOfByte1, 10).readShort() ^ 0xFFFFFFFF) & 0xFFFF;
    byte[] arrayOfByte2 = Arrays.copyOfRange(arrayOfByte1, 12, 16);
    for (int k = 0; k < arrayOfByte2.length; k++)
      arrayOfByte2[k] = ((byte)(arrayOfByte2[k] ^ 0xFFFFFFFF));
    Inet4Address localInet4Address2 = getInet4Address(arrayOfByte2);
    return new TeredoInfo(localInet4Address1, localInet4Address2, j, i);
  }
View Full Code Here

  public static TeredoInfo getTeredoInfo(Inet6Address ip) {
    Preconditions.checkArgument(isTeredoAddress(ip),
        "Address '%s' is not a Teredo address.", toAddrString(ip));

    byte[] bytes = ip.getAddress();
    Inet4Address server = getInet4Address(Arrays.copyOfRange(bytes, 4, 8));

    int flags = ByteStreams.newDataInput(bytes, 8).readShort() & 0xffff;

    // Teredo obfuscates the mapped client port, per section 4 of the RFC.
    int port = ~ByteStreams.newDataInput(bytes, 10).readShort() & 0xffff;

    byte[] clientBytes = Arrays.copyOfRange(bytes, 12, 16);
    for (int i = 0; i < clientBytes.length; i++) {
      // Teredo obfuscates the mapped client IP, per section 4 of the RFC.
      clientBytes[i] = (byte) ~clientBytes[i];
    }
    Inet4Address client = getInet4Address(clientBytes);

    return new TeredoInfo(server, client, port, flags);
  }
View Full Code Here

   * Get the network address.
   *
   * @return
   */
  public Inet4Address getNetworAddress() {
    Inet4Address selectedInetAddress = null;
    try {
      InterfaceAddress interfaceAddress = null;
      if (selectedDialServer != null) {
        String address = selectedDialServer.getIpAddress().getHostAddress();
        String prefix = address.substring(0, address.indexOf('.') + 1);
View Full Code Here

          int pos = file.lastIndexOf('.');
          String extension = "";
          if (pos > -1) {
            extension = file.substring(pos);
          }
          Inet4Address address = getNetworAddress();
          if (address != null) {
            final String url = "http://" + address.getHostAddress() + ":" + port + "/video" + extension;
            if (!rampClient.isClosed()) {
              rampClient.stop();
            }
            rampClient.launchApp(appId==null?APP_ID:appId, selectedDialServer);
            // wait for socket to be ready...
View Full Code Here

      }

      if (!rampClient.isClosed()) {
        rampClient.stop();
      }
      Inet4Address address = getNetworAddress();
      if (address != null) {
        // Play a particular item, with options if necessary
        final String options[] = { ":sout=#transcode{" + transcodingParameterValues + "}:http{mux=webm,dst=:" + vlcPort + "/cast.webm}", ":sout-keep" };
        // http://192.168.0.8:8087/cast.webm
        final String url = "http://" + address.getHostAddress() + ":" + vlcPort + "/cast.webm";
        Log.d(LOG_TAG, "url=" + url);
        if (true || isChromeCast()) {
          rampClient.launchApp(appId==null?APP_ID:appId, selectedDialServer);
          // wait for socket to be ready...
          new Thread(new Runnable() {
View Full Code Here

            final String erlangVersion = new ErlangValue(result.get("erlang_version")).stringValue();
            final int memTotal = new ErlangValue(result.get("mem_total")).intValue();
            final int uptime = new ErlangValue(result.get("uptime")).intValue();
            final String erlangNode = new ErlangValue(result.get("erlang_node")).stringValue();
            final OtpErlangTuple erlIP = (OtpErlangTuple) result.get("ip");
            final Inet4Address ip = (Inet4Address) Inet4Address.getByName(
                    erlIP.elementAt(0) + "." + erlIP.elementAt(1) + "." + erlIP.elementAt(2) + "." + erlIP.elementAt(3));
            final int port = new ErlangValue(result.get("port")).intValue();
            final int yawsPort = new ErlangValue(result.get("yaws_port")).intValue();
            return new GetInfoResult(scalarisVersion, erlangVersion, memTotal, uptime, erlangNode, ip, port, yawsPort);
        } catch (final ClassCastException e) {
View Full Code Here

TOP

Related Classes of java.net.Inet4Address

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.