'''Sends data to alert server'''
import client, sys

try: host=sys.argv[1] #make sure it exsists
except IndexError:
    host = raw_input("What is the IP address of the alert server? ") #Input it manually

try: port=int(sys.argv[2]) #convert the first argument following the server to int
except IndexError:
    while True:
        try: port = int(raw_input("What port is the alert server on? ")) #Input it manually
        except ValueError: print "Sorry but that's not an interger. Try again."
        else: break #once we got it error free, we're done here
except ValueError:
    raise ValueError, "%s isn't an interger. Aborting now." % sys.argv[2] #If there's an error, am doing it my way

sender=client.Client(host=host, port=port) #If there's an error, am doing it my way
while True:
    sender.send("Alert: "+raw_input("What alert do you want to send? "))
