Comment detail

echoクライアント (Nested Flatten)

$ python client_echo.py localhost 7 < input_file > result_file

 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(),

Index

Feed

Other

Link

Pathtraq

loading...