summaryrefslogtreecommitdiff
path: root/CSharp/Ivy
diff options
context:
space:
mode:
Diffstat (limited to 'CSharp/Ivy')
-rw-r--r--CSharp/Ivy/Ivy/IvyTCPStreamV3.cs20
1 files changed, 7 insertions, 13 deletions
diff --git a/CSharp/Ivy/Ivy/IvyTCPStreamV3.cs b/CSharp/Ivy/Ivy/IvyTCPStreamV3.cs
index 12a204e..88e7041 100644
--- a/CSharp/Ivy/Ivy/IvyTCPStreamV3.cs
+++ b/CSharp/Ivy/Ivy/IvyTCPStreamV3.cs
@@ -47,7 +47,7 @@ namespace IvyBus
/*
* message Syntax:
- * this is a binary formated message use of network representation
+ * this is text formated message 'type id STX ARG0 {[ETX] ARG1 [ETX] ARGn}\n'
*
* message Format:
MessageType, id , length, string
@@ -57,27 +57,19 @@ namespace IvyBus
output.Write(arg);
output.Write(sep);
}
- private void Serialize(string arg, char sep)
- {
- output.Write(arg);
- output.Write(sep);
- }
private void Serialize(string[] arg, char sep)
{
- /* serialize value */
- //Serialize(arg.Value);
-
- /* serialize children */
- //Serialize((short)arg.Count);
for (int i = 0; i < arg.Length; i++)
{
- Serialize(arg[i], sep);
+ output.Write(arg[i]);
+ if ( i != (arg.Length-1) ) output.Write(sep);
}
}
private void sendMsg(MessageType msgType, ushort msgId,params string[] msgData)
{
-
+#if DEBUG
Console.WriteLine(" sendMsg {0} id={1} data={2}", msgType, msgId, msgData);
+#endif
Serialize((ushort)msgType, ' ');
Serialize(msgId, ARG_START);
Serialize(msgData, ARG_END);
@@ -206,7 +198,9 @@ namespace IvyBus
msgType = (MessageType)DeserializeShort();
msgId = DeserializeShort();
msgData = DeserializeArgument();
+#if DEBUG
Console.WriteLine(" receiveMsg {0} id={1} data={2}", msgType, msgId, msgData);
+#endif
switch (msgType)
{
case MessageType.Die: