recv loop
authorThomasV <thomasv@gitorious>
Sat, 26 May 2012 04:07:40 +0000 (08:07 +0400)
committerThomasV <thomasv@gitorious>
Sat, 26 May 2012 04:07:40 +0000 (08:07 +0400)
server.py

index 9b04e06..918250b 100755 (executable)
--- a/server.py
+++ b/server.py
@@ -61,7 +61,11 @@ def run_rpc_command(command, stratum_tcp_port):
     method = 'server.' + command
     request = json.dumps( { 'id':0, 'method':method, 'params':[password] } )
     s.send(request + '\n')
-    msg = s.recv(1024)
+    msg = ''
+    while True:
+        o = s.recv(1024)
+        msg += o
+        if msg.find('\n') != -1: break
     s.close()
     r = json.loads(msg).get('result')
     if command == 'stop': print r