Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python please give me the full code including host name and return ip address of host name. 2 3 4 5 6 7 8 9

python
please give me the full code including host name and return ip address of host name. image text in transcribed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 The following code has the following format: # are ordinary comments de describe coment lines that you should replacu with Python code that actually does the thing described in that comment. For example: # a typical hello-world program me print out the string "hello world" You would then take the 49 and replace it so that you would then have . a typical hello-world program print("hello world 17 import socket 18 19 ir _name__ 21 * here's where we set the hostname that we want to resolve 22 you may hardcode it or read from command line or standard input 23 * hostname = 24 # return IP address of hostname try: # here's where we get the address based on the hostname * addr = call to the function that resolves the hostname into an address print('Successfully resolved. The IP address of 1s ().format(hostname, addr)) except socket.gaterror as ert: print ("Can't find hostname: "err) except socket. timeout as err: print ("Can't resolve this hostname due to connection timeout: err) 25 26 28 29 30 31 32 33 34

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

How much of this is in your direct control?

Answered: 1 week ago