How to support both ipv4 and ipv6 address for JAVA code.

IPv6 have colon character, for example FF:00::EE
If concatenate URL String, IPv6 URL will like:
 http://FF:00::EE:8888/a/b/c
Actually we want:
 http://[FF:00::EE]:8888/a/b/c
Simply concatenate URL will cause error.

Take above line for example.

If not use square bracket, can’t identify “8888” is port or part of IPv6 address.
Please use the following code to create new URI
  new URI("http", null,<host>, <port>, <additional URL>, null, null)

How to support both ipv4 and ipv6 address for JAVA code.

时间: 2024-10-12 07:34:27

How to support both ipv4 and ipv6 address for JAVA code.的相关文章

ipv4与ipv6 Inet4Address类和Inet6Address类

在设置本地IP地址的时候,一些人会疑惑IPv4与IPv6的区别是什么?下面由学习啦小编为你分享ipv4与ipv6的区别的相关内容,希望对大家有所帮助. ipv4与ipv6的区别 在windows 7以上系统中,在设置本地IP地址的时候经常会看到同事含有IPV4协议项与IPV6协议项,并不同于以往windows xp系统中仅有TCP/IP协议项,不少朋友都觉得比较奇怪,询问编辑IPv4与IPv6的区别,下面编辑就为大家权威的介绍下IPv4与IPv6有什么区别. 目前的全球因特网所采用的协议族是TC

IPv6基本编程——Java

IPv6编程——Java 1. Java支持IPv6 Java 从 1.4 版开始支持 Linux 和Solaris 平台上的 IPv6.1.5 版起又加入了 Windows 平台上的支持. 在 IPv6 的环境下开发 Java 应用,或者移植已有的 IPv4 环境下开发的Java 应用到 IPv6 环境中来,对于 IPv6 网络地址的验证是必须的步骤,尤其是对那些提供了 UI(用户接口)的 Java 应用. 2. 获取本机IPv6地址 有时为了能够注册 listener,开发人员需要使用本机的

RFC2474 - Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers的双语版

RFC2474 - Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers英文版 来源:http://www.hackhome.com/InfoView/127892_full.html Network Working Group K. NicholsRequest for Comments: 2474 Cisco SystemsObsoletes: 1455, 1349 S.

JBoss7配置之支持IPv4和IPv6双栈环境

由于实验室项目需要,将EJB 3.0的程序部署在JBoss AS 7.1.1.Final中,并要求支持IPv4与IPv6.但其默认配置并不支持IPv6,于是查阅JBoss Community Documentation,即官方文档,在5.4.1 Interfaces and ports节中找到了相关介绍,研究后对JBoss进行配置修改,使JBoss中EJB 3.0的程序能够在IPv4和IPv6双栈环境下正常运行,包括客户端在IPv4环境下获取Remote远程接口对象,调用远程对象的方法收发IPv

IPV4和IPV6之间相互通信

网络拓扑: R1:   ipv6 unicast-routing                                ===========开启ipv6 int f0/0   ip address 192.168.12.1 255.255.255.0    no shutdown    interface Loopback0     ipv6 address 2012:2012::1/64  ip route 192.168.23.0 255.255.255.0 192.168.12.

IPv6 tutorial 4 IPv6 address syntax

https://4sysops.com/archives/ipv6-tutorial-part-4-ipv6-address-syntax/ Now that you know about the new features of IPv6, it is time to have a closer look at the practical details. In this post, I will give a short summary about the IPv6 address synta

Convert IPv6 Address to IP numbers (C#)

URL: http://lite.ip2location.com/ Use the code below to convert the IP address of your web visitors and lookup for their geographical location, e.g. country, state, city, latitude/longitude, ZIPs, timezone and so on. Free database can be downloaded a

ISIS协议的IPv4和IPv6的标准

拓扑图拓扑图 ?实验目的: 测试该拓扑中运行ISIS协议下同时开启IPV4和IPV6,在中间路由器IPV6不连续的情况下,两端的路由器能获得对方的ipv6路由,但是无法ping通. 实验要求: 1.各路由器对应链路上的地址按:ipv4为XY.1.1.X/Y--/24,换回口地址按:X.X.X.X/32 ipv6为:2001:XY::X/Y--/64,换回口地址按:2012::X/128 2.在R1到R4路由器上配置IPV4的ISIS进程并在所有相关接口开启ISIS协议 3.在R1和R2,R3和R

IPv4兼容IPv6隧道配置

R1#config t R1(config)#interface fa0/0 R1(config-if)#ip add 8.1.1.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#interface loopback 0 R1(config-if)#ipv6 enable R1(config-if)#ipv6 address 2001::1/96 R1(config-if)#no shut R1(config