码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2014-07-11 12:51:16      阅读:291      评论:0      收藏:0      [点我收藏+]

标签:style   http   java   color   os   art   


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.,布布扣,bubuko.com

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

标签:style   http   java   color   os   art   

原文地址:http://www.cnblogs.com/lpthread/p/3833913.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!