如何查看链接的状态?

时间:2017-06-09 08:57:39

标签: network-programming tcl ns2 wireless-connection

我正在使用AODV路由协议在ns2中运行MANET模拟。有什么方法可以检查节点是否将收到的数据转发到路由中的下一个节点,或者检查2个节点之间的链路是否有效?

1 个答案:

答案 0 :(得分:0)

Try this:

package require http
package require tls
http::register https 443 [list ::tls::socket -tls1 1]
set url "https://google.com"
if {![catch {set token [::http::geturl $url]} msg]} {
    if {[::http::status $token] == "ok"} {
        #Do something when token is ok for example print HTTTP code
        puts [::http::code $token]
    } else {
        #Do something when status token is not ok
    }
} else {
    #print error when Url is invalid or host is unreachable
     puts "oops: $msg"
}