Hello!
As the subject says I need to test whether a host computer in our
network is reachable or not. At the moment I simply attempt to connect
to a given port that is open when the machine is online:
[...]
sock = socket.socket(s ocket.AF_INET, socket.SOCK_STR EAM)
try:
sock.connect((' 192.168.0.100', 80))
except socket.error:
print >>sys.stderr "Server offline"
sock.close()
[...]
Now I am wondering if there isn't any better method which would be more
general. In fact, I think of something like a python version of ping
which only tries to send ICMP packets. However, I don't know what the
code has to look like then. Any ideas or suggestions?
Thanks,
Fabian 5 20632
On 2/22/07, Fabian Steiner <li***@fabis-site.netwrote:
Hello!
As the subject says I need to test whether a host computer in our
network is reachable or not. At the moment I simply attempt to connect
to a given port that is open when the machine is online:
[...]
sock = socket.socket(s ocket.AF_INET, socket.SOCK_STR EAM)
try:
sock.connect((' 192.168.0.100', 80))
except socket.error:
print >>sys.stderr "Server offline"
sock.close()
[...]
Now I am wondering if there isn't any better method which would be more
general. In fact, I think of something like a python version of ping
which only tries to send ICMP packets. However, I don't know what the
code has to look like then. Any ideas or suggestions?
This is the only reliable way of telling if you can communicate with a
service on a machine. A ping will tell you if it's connected to the
network, but not if it is actually providing any services.
If you really want a ping, the common way is to just execute the systems ping.
Fabian Steiner wrote:
Hello!
As the subject says I need to test whether a host computer in our
network is reachable or not. At the moment I simply attempt to connect
to a given port that is open when the machine is online:
[...]
sock = socket.socket(s ocket.AF_INET, socket.SOCK_STR EAM)
try:
sock.connect((' 192.168.0.100', 80))
except socket.error:
print >>sys.stderr "Server offline"
sock.close()
[...]
Now I am wondering if there isn't any better method which would be more
general. In fact, I think of something like a python version of ping
which only tries to send ICMP packets. However, I don't know what the
code has to look like then. Any ideas or suggestions?
Thanks,
Fabian
Just because you could ping with ICMP packets doesn't mean you could
do anything with the machine. I assume that you are connecting to
do something on the machine. Just wrap what you are trying to do
in try: block. It will either succeed or fail. Handle the exeption.
-Larry
Just because you could ping with ICMP packets doesn't mean you could
do anything with the machine. I assume that you are connecting to
do something on the machine. Just wrap what you are trying to do
in try: block. It will either succeed or fail. Handle the exeption.
And the other way round: just because you can't ping a machine doesn't mean
you can't do anything with it - a Firewall might just have snipped away all
the ICMP-packets.
Diez
Hello!
Chris Mellon wrote:
On 2/22/07, Fabian Steiner <li***@fabis-site.netwrote:
>[...] Now I am wondering if there isn't any better method which would be more general. In fact, I think of something like a python version of ping which only tries to send ICMP packets. However, I don't know what the code has to look like then. Any ideas or suggestions?
This is the only reliable way of telling if you can communicate with a
service on a machine. A ping will tell you if it's connected to the
network, but not if it is actually providing any services.
If you really want a ping, the common way is to just execute the systems
ping.
Ok, obviously, my approach was already the best way to achive this aim.
Thanks for you help,
Fabian
On Feb 22, 3:22 pm, Fabian Steiner <l...@fabis-site.netwrote:
Now I am wondering if there isn't any better method which would be more
general. In fact, I think of something like a python version of ping
which only tries to send ICMP packets.
Server or a firewall in between most probably will filter out any ICMP
packets, so you'll get no pings at all from a machine which IS on-
line. The only way is try the services that you know, that should be
open on that machine. Do not try too many at a time, becouse that
could be interpeted as portscan and you'll get blacklisted. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jussi Mononen |
last post by:
Hi,
I'm having problems to successfully execute the test scripts on a
Compaq host ( OSF1 tr51bdev V5.1 2650 alpha ). Almost all tests end up
with the following error message
"PARI: *** Invalid arguments to divll. at test_eng/Testout.pm line
30.
...propagated at t/polyser.t line 9.
t/polyser.....dubious
|
by: cpavon |
last post by:
Hello everyone,
I am fairly new to MACT, I am currently trying to parse the
oResponse.Body to retrive a dynamic values...store in an array and then
randomly post those values.
Does anyone have any sample code on how to parse the oResponse.Body?
This is what I have so far but I cannot seem to get the value I'm
trying to pick up.
|
by: gallaczmit |
last post by:
Will this code give me a true view of a computer's status? All I am
looking for is to see if the computer is reachable or not.
My end goal is to get a list of IP addresses from a MS SQL Server, see
if the IP is reachable(if yes I will assume the pc is operational),
update the database with the result and generate a web page displaying
the results.
I am using port 135 because I have an all windows network and this
port should be open...
|
by: SevDer |
last post by:
Is there a way to test guid string?
I want to do it without try catch block to save on performance.
Thanks in advance.
--
SevDer
|
by: Netkiller |
last post by:
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Project: Network News Transport Protocol Server Program
Description:
基于数据库的新闻组,实现BBS前端使用NNTP协议来访问贴子
Reference:
NNTP协议: http://www.mibsoftware.com/userkt/0099.htm
正则表达式:
http://wiki.woodpecker.org.cn/moin/RegExpInPython#head-2358765384844ed72f01658cbcde24613d941e9d
| |
by: adalton |
last post by:
I've been trying to figure out how to test for a valid internet connection.
I am able to connect to a valid internet connection, but when it drops, or
if it is not there when my program starts, I get an exception.
This probably is a newbie question, but I do not even know what or how I
would trap that error.
|
by: Ke Tao |
last post by:
HI All,
Is there anybody have an idea of how to detect internet is reachable ?
At present , I'm using ping to detect internet is reachable , but it's
maybe a bad idea , some firewall of router may block ping requesting.
Best Regards,
Ke Tao
|
by: rich_sposato |
last post by:
I released version 2.0 of C++ Unit Test Library. You can download
it from SourceForget.Net at http://sourceforge.net/projects/cppunittest/
..
I wrote this unit test library because other unit test frameworks
always lacked features I considered important. Some only provided
output in certain formats, and I had no easy way to choose my own
format. Most provided no protection against exceptions. Only a few
were useful for unit-testing...
|
by: GeH |
last post by:
Is there any possibility to detect if an object is reachable and can
be collected by the GarbageCollector?
I'm using a cache of weak references to persistent objects. Objects
are then accessed using an ObjectID. If the object is still alive, the
object is retrieved from the cache, if not, it will be fetched from a
database and the referece is returned to the caller.
Now I'm trying to implement a kind of automatic pessimistic locking:...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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...
|
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 projectplanning, coding, testing, and deploymentwithout 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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |