Skip to content

Commit

Permalink
increase read try counter
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian-Barthel committed Aug 13, 2024
1 parent 38ed217 commit ab2658e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions splatviz_network/splatviz_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,19 @@ def try_connect(self):

def read(self):
messageLength = self.conn.recv(4)
messageLength = int.from_bytes(messageLength, 'little')
message = self.conn.recv(messageLength)
expected_bytes = int.from_bytes(messageLength, 'little')

current_bytes = 0
try_counter = 10
counter = 0
message = bytes()
while current_bytes < expected_bytes:
message += self.conn.recv(expected_bytes - current_bytes)
current_bytes = len(message)
counter += 1
if counter > try_counter:
print("Package loss")
break
return json.loads(message.decode("utf-8"))

def send(self, message_bytes, training_stats):
Expand Down
2 changes: 1 addition & 1 deletion viz_renderer/attach_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def read(self, resolution):
try:
current_bytes = 0
expected_bytes = resolution * resolution * 3
try_counter = 3
try_counter = 10
counter = 0
message = bytes()
while current_bytes < expected_bytes:
Expand Down

0 comments on commit ab2658e

Please sign in to comment.