Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Combine size and message to avoid sending separate packets.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Oct 6, 2009
1 parent ed4b0b5 commit 50bc10d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/zc/ngi/adapters.py
Expand Up @@ -90,6 +90,5 @@ def write(self, message):
if message is None:
self.connection.write('\xff\xff\xff\xff')
else:
self.connection.write(struct.pack(">I", len(message)))
self.connection.write(message)
self.connection.write(struct.pack(">I", len(message))+message)

3 changes: 1 addition & 2 deletions src/zc/ngi/adapters.txt
Expand Up @@ -94,8 +94,7 @@ If we write a message, we can see that the message is preceded by the
message size:

>>> adapter.write(message1)
-> '\x00\x00\x00\x19'
-> 'Hello\nWorld!\nHow are you?'
-> '\x00\x00\x00\x19Hello\nWorld!\nHow are you?'

Null messages
-------------
Expand Down

0 comments on commit 50bc10d

Please sign in to comment.