#!/usr/bin/python
#
# Usage: bldsubmit.py host port ip
#
# Connect to bld on host:port to submit ip
#

import sys, socket

MAX_CMD_LEN = 80

if len(sys.argv) < 4:
   print "Usage: "+sys.argv[0]+" host port ip"
   sys.exit(1)

host = sys.argv[1]
port = int(sys.argv[2])
ip = sys.argv[3]

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))

data = s.recv(MAX_CMD_LEN)
if not data:
   s.close()
s.send("ip="+ip+"\r\n")
data = s.recv(MAX_CMD_LEN)
s.close()
data.rstrip()
print data,
