473,667 Members | 2,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Testing for connection to a website


Okay, I already made this post, but it kinda got lost. 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. So I don't know if that was what you
guys wanted me to do, but I don't think so, you guys are smarter than that.
So, how can I test for connection to a website.
--
View this message in context: http://www.nabble.com/Testing-for-co...p18473382.html
Sent from the Python - python-list mailing list archive at Nabble.com.

Jul 15 '08 #1
3 2074
On Jul 15, 3:43*pm, Alexnb <alexnbr...@gma il.comwrote:
Okay, I already made this post, but it kinda got lost. 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. So I don't know if that was what you
guys wanted me to do, but I don't think so, you guys are smarter than that.
So, how can I test for connection to a website.
--
View this message in context:http://www.nabble.com/Testing-for-co...te-tp18473382p...
Sent from the Python - python-list mailing list archive at Nabble.com.
Ping it? ~_^
Jul 15 '08 #2
On 2008-07-15, Alexnb <al********@gma il.comwrote:
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!!
visi.com
Jul 15 '08 #3
Alexnb wrote:
Okay, I already made this post, but it kinda got lost. 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. So I don't know if that was what you
guys wanted me to do, but I don't think so, you guys are smarter than that.
So, how can I test for connection to a website.
You can test DNS resolution by doing this:

import socket
#
# Check to make sure domain is legal and that I can resolve it to IP addr
#
try:
ipaddr=socket.g ethostbyname(do main)
except socket.gaierror :
print "Internet connection or DNS error"

For the "connect to a specific website" portion you just have to wait until it
times out to determine failure.

-Larry
Jul 15 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1633
by: Karuna | last post by:
Hi, I have developed a website in my local machine using PHP, MySql and apache. It's not uploaded on the net. The pesrson for whom I have developed this wants to test it before actually putting it online on their website. How do I let her test it? Is there a way? regards Karuna
3
3091
by: Maellic | last post by:
Hi, The website I am working on is built with ASP.NET and connects to a SQL Server 2000 database. The web server and database are on the same machine. I have recently tried to modify the timeout of the website from 20 mn to 60 mn. I changed the timeout setting in IIS. Now the website itself doesn't time out, however after 20 mn, when I try to access a page that needs to connect to the database, I get the following error message
0
1025
by: Gustavo Barbosa | last post by:
I´m having this problem: I'm stress testing a ASP.NET web application using ACT and comparing results with a previous version of the website (developed in ColdFusion 4.5). When using 300 simultaneous users (about 25-30 rps), everything works fine, although Cold Fusion seems to be a little faster than ASP.NET. When using 2000 simultaneous users (about 50-60 rps), Cold Fusion works really fine but the application in ASP.NET starts to have...
8
30802
by: hufaunder | last post by:
I have a website that consumes a webservice. Both of them are in the Default Website folder. I can execute the service without any problem when I go to the test page http://localhost/Service.asmx. When I try to consume that webservice from the website I get the error shown bellow. In my web.config I have: <authentication mode="Windows"/> <identity impersonate="true" userName="auser" password="apwd"/> IIS is configured as "Integrated...
5
7694
by: OJ | last post by:
Hi, I am at a loss here, I have a c# asp.net website which connects to a remote SQL Server 2000 db via a connection string. If I set the website up in the filesystem and use the inbuilt cassini webserver in VS2005 then everything is rosy. If I then set up the website on the local IIS 5.1 the site no longer connects and returns this error: An error has occurred while establishing a connection to the server. When connecting to SQL Server...
2
4953
by: samadams_2006 | last post by:
Hello, I have a problem that I'm hoping someone will be able to help me resolve. 1) I have a C# Web Site in which I connect to the database: "Install Microsoft SQL Server 2005 Express Edition" via the link on: http://msdn2.microsoft.com/en-us/express/bb410792.aspx
0
1240
by: Alexnb | last post by:
Timothy Grant wrote: well I can tel you it didn't work for me. In fact I didn't see the code you posted on there, I ended up figuring it out on my own with a little help from the missing manual for urllib2. Also, being rude is kinda stupid because you don't have to help in the first place... -- View this message in context: http://www.nabble.com/Testing-for-connection-to-a-website-tp18473382p18478103.html Sent from the Python -...
21
2505
by: =?ISO-8859-1?Q?Fad=A5?= | last post by:
Hello guys, I want to do kinda of an A/B split testing on a website I run. I just created a new version but I need to keep both version running and see which one will perform better. First, I'm not sure if I'm in the right group. How can I randomly let a user enter from the index.php page and keep the same URL. So the splitting is being done in the backend, I don't want the users to see for example in the url /new/index.php and /...
0
8457
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8365
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8788
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8646
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7390
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.