#!/usr/bin/env python
import socket,re,sys
def check_mysql(address,port):
    s=socket.socket()
    try:
        s.connect((address,port))
        return True
    except socket.error,e:
        return False
    
port=3306
file=open('d:/1.txt')
addresses=file.readlines()
for address in addresses:
    if check_mysql(address,port):
        print address