Created
April 6, 2017 11:19
-
-
Save rane-hs/b669a80d7f99af2d641ce518f6ab42db to your computer and use it in GitHub Desktop.
hoge1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import socket | |
_term = '' | |
if sys.version_info.major >= 2: | |
_term = b'' | |
content = sys.stdin.read() | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect(('127.0.0.1', int(sys.argv[1]))) | |
s.sendall(content) | |
s.shutdown(socket.SHUT_WR) | |
while 1: | |
data = s.recv(1024) | |
if data == _term: | |
break | |
sys.stdout.write(data) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment