1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#!/usr/bin/python
# -*- coding: utf8 -*-
import sys, socket

host, port = sys.argv[1:3]
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, int(port)))
sf = s.makefile()

for line in sys.stdin:
    sf.write(line)
    sf.flush()
    print sf.readline(),