diff -r 000000000000 -r 1be4b68bfb0e gmyth-stream/server/0.1/tests/client.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmyth-stream/server/0.1/tests/client.py Sat Jun 30 00:25:48 2007 +0100 @@ -0,0 +1,51 @@ +import os +import sys +import time +import socket + + +if len(sys.argv) < 2: + HOST = 'localhost' + PORT = 50000 +elif len(sys.argv) == 2: + HOST = sys.argv[1] + PORT = 50000 +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 += " -idx - -vo x11 1> /dev/null" +pin, pout = os.popen2(mplayer) + +#teste = open("teste.avi", "w") + +data = socket.recv(4096) +i = 0 + +while (data != ""): + pin.write(data) + #teste.write(data) + data = socket.recv(4096) + #if (i == 500): + # socket.send("OK") + i += 1 + +pin.close() +socket.close() +#teste.close() + +# from select import select +# r, w, x = select([pout], []. [], 0) +# if pout in r: +# pout.read(32)