Cecil Westerhof <
Ce...@decebal.nl> wrote:
> I defined the following proc:
> proc ::dcblUtilities::getInternetConnection {{IPAddress 208.67.222.222}} {
> try {
> set fd [socket ${IPAddress} 53]
> close $fd
> set errorMsg {}
> set status Connected
> } on error msg {
> set notConnRegexp "\^couldn't open socket: network is unreachable"
> if {[regexp ${notConnRegexp} ${::errorInfo}]} {
> set errorMsg {}
> set status {NOT connected}
> } else {
> set errorMsg ${::errorCode}
> set status {Unexpected error}
> }
> }
> list ${status} ${errorMsg}
> }
>
> Today I got an 'Unexpected error' with errorMsg:
> POSIX ETIMEDOUT {connection timed out}
>
> I interpret this as: there was an internet connection, but the DNS
> server was not reachable. Is this a correct interpretation, or could
> it still be that I did not have an internet connection?
DNS is carried over UDP.
So the most that you know is:
1) an outgoing UDP packet, addressed to the destination, was
transmitted
2) no reply packet arrived (within the window of the timeout)
The 'reason' for "no reply packet arrived" can not be determined by the
networking layer (and by extension, your code, nor you).
It could be the outgoing UDP packet was dropped somewhere along the
way.
It could be that the reply UDP packet was dropped somewhere along the
way.
The two above could be indicators of buffer bloat somewhere in the
path.
It could be that some link along the path was down (but not returning
"no route to host" replies).
It could be that a link along the path was down, and was returning "no
route" replies, but the no route reply was itself dropped somewhere.
It could be that the DNS server at the far end was simply hung (such
that the packet went all the way there, but was never handled).
And we could probably spin a hundred more possible reasons why.