1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
otez555 [7]
3 years ago
13

Write an If/else statement to check whether host is online. If it is online, then print system is online otherwise print system

is unreachable.
Computers and Technology
1 answer:
Reika [66]3 years ago
4 0

Answer:

from socket import *

hostname = input('Enter the host to be scanned: ')

ip_add = gethostbyname(hostname)

connections = [ ]    

for i in range(133, 136):

   s = socket(AF_INET, SOCK_STREAM)

     

   conn = s.connect_ex((ip_add, i))

   print(conn)

   connections.append(conn)

if 0 in connections:

   print ('Host is online')

   s.close()

else:

   print ('system is unreachable')

Explanation:

The python source code above scans for all the available range of ports in the provided hostname, if any port is available, the host is online else the program print the error message "system is unreachable.

You might be interested in
Can Word Processing (WP) programs be used for DTP? Explain your answer
siniylev [52]

Word Processing Programs cannot be used for DTP

Explanation:

DTP software cannot be replaced with Word Processing Programs.  DTP software is used for creating publishing document like post card, business card, calendars, and books where as the word processing software is used for creating and editing predominantly text document and once can edit text, copy, paste , delete and format text. Word processor relies heavily on editing of the contents rather than graphics or page layout where as DTP software is used to create image heavy newsletters, magazines, adverts, and brochures where layout is important.

4 0
3 years ago
What is one benefit of using electronic sticky notes ?
balu736 [363]
They can be used to just copy/paste e-mailed information without writing down on a paper and losing valuable time. This is one example.
4 0
3 years ago
Read 2 more answers
If i don't update my computer what threat does my computer face?
Nadusha1986 [10]
Hey there! Hello!

Computer updates, especially smaller security updates, contain security information for new bugs, malware, viruses, etc. that have been written since your last update. So many of these are written for computers at any given time, meaning that keeping your computer updated is a significant step in keeping your computer's defense systems working. Paired up with legit anti-malware, virus protection software, good computer knowledge, and common sense, your computer can remain very safe from these viruses. 

Otherwise, there might be some bug or irregularity within your computer's system itself that was accidentally released an update or two ago by the creators of your computer's software, which may also pose a threat for your computer system. Updating your computer can most likely fix problems like these. But, more commonly, they just keep your computer up to date on the vicious computer threats that are now available for it since the previous update. 

Hope this helped you out! Feel free to ask me any additional questions if you have any. :-)

8 0
3 years ago
Explain the two filter options available when filtering by a column
dexar [7]
Can you prove more information?
8 0
3 years ago
Read 2 more answers
Which of the following are examples of IT
Advocard [28]

Answer:

Computer hardware engineer

Systems analyst

Database administrator

7 0
3 years ago
Other questions:
  • The number of bits used to store color information about each pixel is called ____.
    13·1 answer
  • You can leave out the ____ statements in a switch structure.
    15·1 answer
  • If johnny has 800 socks and john has 1000 more how much does john have
    9·1 answer
  • Using a cell phone while operating a motor vehicle is considered distraction because
    8·1 answer
  • Why do you classify computers?
    6·1 answer
  • A cover letter should simply restate what is included in your résumé.<br> True<br> False
    7·2 answers
  • All of the following are true about data science and big data except: a.Digital data is growing at the rate of 2.5 quintillion b
    15·1 answer
  • Who is famous for his three laws of robotics?
    9·1 answer
  • What instructions would a computer have the hardest time completing correctly
    12·1 answer
  • Which of the following digital communicatio media does not require a connection to the internet
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!