From The Compiler, 6 Years ago, written in Python.
Embed
  1. import sys, os
  2. import socket
  3.  
  4. servers = [ "megusta.iotairc.net", "rawr.iotairc.net",
  5.             "mbilker.iotairc.net", "alexg.iotairc.net",
  6.             "bitchplease.iotairc.net", "mudkip.iotairc.net",
  7.             "raptor.iotairc.net", "haddaway.iotairc.net",
  8.             "toaster.iotairc.net" ]
  9.  
  10. with open("status.txt", "w") as f:
  11.     for server in servers:
  12.         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  13.         try:
  14.             sock.connect((server, 6667))
  15.         except socket.gaierror:
  16.             f.write("{} = offline\n".format(server))
  17.         else:
  18.             f.write("{} = online\n".format(server))
  19.         finally:
  20.             sock.close()