从字面上看java.net.Inet6Address.getByName是否会出去并查看地址是否存在

编程入门 行业动态 更新时间:2024-10-28 17:25:05
本文介绍了从字面上看java.Inet6Address.getByName是否会出去并查看地址是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不知道Java,但您可以从此问题中看到( Oracle正则表达式(REGEXP_LIKE)太长错误-ORA-12733 )如果IPv6地址格式正确,Java似乎是最容易完成的验证.我尝试使用正则表达式,虽然接近,但却是一场噩梦,而且对于PL/SQL来说,表达式太长了.

我在Oracle中使用Java进行工作.我只想验证格式,而不是地址确实存在.那么java.Inet6Address.getByName真的会出去看看地址是否存在吗?

文档说...( docs.oracle/javase/1.5.0/docs/api/java/net/InetAddress.html#getByName(java.lang.String))

"如果提供了原义IP地址,则仅检查地址格式的有效性."

我正在接受它,因为它无法ping通,我是否正确理解了?

解决方案

这是正确的理解-它不会不发出 ICMP PING .

但是,必须出门"以解析主机名(通过 DNS ).

当然,当提供IP文字时,则不需要这样解析..仅当尝试进行名称解析确定/正常时,才使用此方法.通常使用它来检查IP文字的有效性时要小心.

I don't know java but as you can see from this question (Oracle Regular Expression (REGEXP_LIKE) Too Long Error - ORA-12733) java seems to be the easiest to accomplish validating if an IPv6 address is formatted correctly. I tried regular expressions, came close, but was a nightmare, and the expression is too long for PL/SQL.

I have the java in Oracle way working. I only want to validate the format, not that the address really exists. So does java.Inet6Address.getByName literally go out and see if the address exists?

The documentation says... (docs.oracle/javase/1.5.0/docs/api/java/net/InetAddress.html#getByName(java.lang.String))

"If a literal IP address is supplied, only the validity of the address format is checked."

I'm taking that as it does NOT ping, am I understanding that correctly?

解决方案

That is a correct understanding - it does not issue an ICMP PING.

However, it must "Go Out" to resolve the host-name (via DNS).

Of course, when an IP literal supplied, then there is no need to resolve as such .. Use this method only if attempting a name resolve is OK/desired. Be wary when using it to generally check for the validity of an IP literal.

更多推荐

从字面上看java.net.Inet6Address.getByName是否会出去并查看地址是否存在

本文发布于:2023-11-23 11:02:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621216.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字面   上看   是否会   是否存在   地址

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!