box-o-sand/ruby-sockets/ping-pong/client.py

12 lines
266 B
Python
Raw Normal View History

2012-06-15 14:19:06 +00:00
import socket
import sys
import time
while True:
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('localhost', 24000))
client.send('PING\n')
sys.stdout.write('client: RECV {}'.format(client.recv(100)))
time.sleep(0.5)