Testing for connection to a website
grante at visi.com
Tue Jul 15 21:49:19 CEST 2008
On 2008-07-15, Alexnb <alexnbryan at gmail.com> wrote:
> Okay, I already made this post, but it kinda got lost.
No, it didn't get lost. Your question was answered and you
didn't like the answer.
> So anyway I need to figure out how to test if the user is able
> to connect to a specific website. Last time I got pointed to
> the urllib2 page, but if I do urlopen() and and am not
> connected, the program stops.
How long did you wait? Depending on what/how/where the network
is broken, it make take a minute or two for the connection
attempt to fail. You may not like it, but that's how TCP
works. You're concerned with TCP connections, so you're going
to have to live with it.
> So I don't know if that was what you guys wanted me to do,
Yes it was what we advised you to do.
> but I don't think so, you guys are smarter than that. So, how
> can I test for connection to a website.
Like we told you:
1) Open a connection using urllib or urllib2.
2) The attempt will either fail or succeed.
3) Proceed accordingly.
Grant Edwards grante Yow! HUGH BEAUMONT died
at in 1982!!
More information about the Python-list