From 2b6b55af13f7bee9a35e37e2338fd21c2dc2bfc4 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Thu, 4 Apr 2019 07:57:29 +0930 Subject: [PATCH] Update python client example of Remote IO --- docs/remote_io_protocol.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/remote_io_protocol.rst b/docs/remote_io_protocol.rst index f243a5e5..3e4cd5ab 100644 --- a/docs/remote_io_protocol.rst +++ b/docs/remote_io_protocol.rst @@ -29,16 +29,23 @@ Python Example import socket import binascii + import uuid TCP_IP = '127.0.0.1' TCP_PORT = 53309 BUFFER_SIZE = 4096 + def genId(): + return "{" + str(uuid.uuid4()) + "}" + + firstNodeId = genId() + secondNodeId = genId() + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((TCP_IP, TCP_PORT)) - s.send(binascii.hexlify("addnodewithid {3dc475f6-dcda-45b8-bb76-59948db39968} 0.51 0.51 1.01 0.08") + "\0") - s.send(binascii.hexlify("addnodewithid {3dc475f6-dcda-45b8-bb76-59948db39969} 0.51 0.51 1.51 0.08") + "\0") - s.send(binascii.hexlify("addedge {3dc475f6-dcda-45b8-bb76-59948db39968} {3dc475f6-dcda-45b8-bb76-59948db39969}") + "\0") + s.send(binascii.hexlify("addnodewithid " + firstNodeId + " 0.51 0.51 1.01 0.08") + "\0") + s.send(binascii.hexlify("addnodewithid " + secondNodeId + " 0.51 0.51 1.51 0.08") + "\0") + s.send(binascii.hexlify("addedge " + firstNodeId + " " + secondNodeId + "") + "\0") s.send(binascii.hexlify("savesnapshot") + "\0") s.send(binascii.hexlify("exportAsObj") + "\0") #s.send(binascii.hexlify("getNodePartId {3dc475f6-dcda-45b8-bb76-59948db39968}") + "\0")