473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

IP address of webserver

How can I find server's IP address?
>From console I can use ping, for example:
C:\RobotP\cgi-bin>ping www.google.com

Pinging www.google.com [209.85.129.147] with 32 bytes of data:

Reply from 209.85.129.147: bytes=32 time=30ms TTL=244
Reply from 209.85.129.147: bytes=32 time=30ms TTL=244
...
...
So I know that www.google.com has 209.85.129.147 IP address.
But how can I find it directly from Python script?
Thanks for help
J.

Jan 27 '07 #1
2 1263
"Johny" <py****@hope.czwrites:
So I know that www.google.com has 209.85.129.147 IP address.
But how can I find it directly from Python script?
>>import socket
print socket.gethostbyname('www.google.com')
66.102.7.147
>>>
Jan 27 '07 #2
"Johny" <py****@hope.czescribió en el mensaje
news:11*********************@a75g2000cwd.googlegro ups.com...
How can I find server's IP address?
>>From console I can use ping, for example:

C:\RobotP\cgi-bin>ping www.google.com
Pinging www.google.com [209.85.129.147] with 32 bytes of data:
[...]
But how can I find it directly from Python script?
pyimport socket
pyhelp(socket.gethostbyname)
Help on built-in function gethostbyname in module _socket:

gethostbyname(...)
gethostbyname(host) -address

Return the IP address (a string of the form '255.255.255.255') for a
host.

pysocket.gethostbyname("www.google.com")
'209.85.165.147'

--
Gabriel Genellina
Jan 27 '07 #3

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

Similar topics

3
by: Juha Suni | last post by:
I was faced with a difficult configuration issue a few days ago with another companys web service. In short, their web service requires the user to login on their page before their service can be...
2
by: David | last post by:
Hi I'm trying to get remote ip address and local ip address of the user (i.e. machine name) but i couldnt find out it. however i can see the public remote ip address.here is the little code that...
3
by: ysu | last post by:
HI, I have a application need call a webserver, I want know who is call the webserver, how to do?
4
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> ...
4
by: ojorus | last post by:
Hi. I have a problem when I use the $_SERVER. I'm testing a script, and the strange thing is that remote_addr returns an ip-address only sometimes, and not always. Why can that be? Are there any...
4
by: scott.horne | last post by:
I have a machine with multiple IP addresses and I want to select the IP address used by my script when it connects to another location. Does any one know a way to select which IP address to use...
1
by: danknauf | last post by:
I have a webserver which is behaving strangely. The server is a fresh copy of Windows 2003 running IIS with default options + Active Server Pages installed. The server is connected to a Linksys...
14
by: John Kotuby | last post by:
Hi all, I have a situation where a Web Server at an install site does not currently have a publically registered Domain Name associated with the site. This requires that the a user access the...
10
by: Mike Miller | last post by:
Hi, Am wanting to send email with php and need to access the global outlook address book. Are there any examples/tutorials on how to do this? M
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.