diff -r 000000000000 -r 8f9fe41efa81 gmyth-stream/server/tests/client.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmyth-stream/server/tests/client.py Wed Apr 04 16:47:00 2007 +0100 @@ -0,0 +1,51 @@ +import os +import sys +import time +import socket + + +if len(sys.argv) < 2: + HOST = 'localhost' + PORT = 5000 +elif len(sys.argv) == 2: + HOST = sys.argv[1] + PORT = 5000 +else: + HOST = sys.argv[1] + PORT = int(sys.argv[2]) + +socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) +socket.settimeout(10) + +try: + socket.connect( (HOST,PORT) ) +except: + print "\n--> Could not connect to ('%s':'%d')\n" % (HOST,PORT) + sys.exit(-1) + + +mplayer = os.popen("which mplayer").read().strip() +mplayer += " - 1> /dev/null" +pin, pout = os.popen2(mplayer) + +#teste = open("/tmp/teste2", "w") + +data = socket.recv(1024) +i = 0 + +while (data != ""): + pin.write(data) + #teste.write(data) + data = socket.recv(1024) + if (i == 500): + socket.send("OK") + i += 1 + +pin.close() +socket.close() + + +# from select import select +# r, w, x = select([pout], []. [], 0) +# if pout in r: +# pout.read(32)