Commits

Matt Bone committed 7082bc9

just committing this crap before bed

Comments (0)

Files changed (2)

     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     #now connect to the web server on port 80
     # - the normal http port
-    s.connect(("mbone-desktop", 8889))
+    s.connect(("mbone-asus", 8889))
     s.send(b"asdf:jkl")
     s.close()
 
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-    s.connect(("mbone-desktop", 8889))
+    s.connect(("mbone-asus", 8889))
     s.send(b"qwer:123")
     s.close()
 
 MEMO_QUEUE = {}
 
+RECV_SIZE = 1024
+
 class Updater(object):
     lock = threading.Lock()
 
     def __init__(self, clientsocket):
         self.clientsocket = clientsocket
 
+    # def run(self):
+    #     print("doing something")
+    #     msg = ''
+    #     while len(msg) < MSG_LEN:
+    #         chunk = self.clientsocket.recv(MSG_LEN-len(msg))
+    #         chunk = chunk.decode()
+    #         if chunk == '':
+    #             raise RuntimeError("socket connection broken")
+    #         msg = msg + chunk
+    #     msg_parts = msg.split(":")        
+    #     self.update_memo_queue(msg_parts[0], msg_parts[1])
+
     def run(self):
-        print("doing something")
-        msg = ''
-        while len(msg) < MSG_LEN:
-            chunk = self.clientsocket.recv(MSG_LEN-len(msg))
-            chunk = chunk.decode()
-            if chunk == '':
-                raise RuntimeError("socket connection broken")
-            msg = msg + chunk
-        msg_parts = msg.split(":")
+        print("run()")
+        chunks = []
+        chunk = -1
+        while chunk != "":
+            chunk = self.clientsocket.recv(RECV_SIZE)
+            msg += chunk.decode()
+            print(chunk)
+        msg_parts = msg.split(":")        
+        self.update_memo_queue(msg_parts[0], msg_parts[1])
+
+            
         
-        self.update_memo_queue(msg_parts[0], msg_parts[1])      
+            
 
     def update_memo_queue(self, key, value):
         #very pessimistic piece of crap to begin
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.