summaryrefslogtreecommitdiff
path: root/CSharp/Ivy/IvyPPC
diff options
context:
space:
mode:
authorfcolin2007-02-01 10:02:52 +0000
committerfcolin2007-02-01 10:02:52 +0000
commitcc9b73f875fcbbbbd86ef05464ba46c934888537 (patch)
tree4d73f191cde4867d38e12b8dfa7b4682c0cd3d9e /CSharp/Ivy/IvyPPC
parent0abfdca67b16f9ccbdb3b9d60df8aa12688d2c48 (diff)
downloadivy-csharp-cc9b73f875fcbbbbd86ef05464ba46c934888537.zip
ivy-csharp-cc9b73f875fcbbbbd86ef05464ba46c934888537.tar.gz
ivy-csharp-cc9b73f875fcbbbbd86ef05464ba46c934888537.tar.bz2
ivy-csharp-cc9b73f875fcbbbbd86ef05464ba46c934888537.tar.xz
Utilisateur : Fcolin Date : 2/06/06 Heure : 16:47 Archivé dans $/CSharp/Ivy/Ivy Commentaire: Mise en conformite du code avec les guidelines , et changement prototype evenements (vss 6)
Diffstat (limited to 'CSharp/Ivy/IvyPPC')
-rw-r--r--CSharp/Ivy/IvyPPC/IvyUDPStreamV3.cs26
1 files changed, 18 insertions, 8 deletions
diff --git a/CSharp/Ivy/IvyPPC/IvyUDPStreamV3.cs b/CSharp/Ivy/IvyPPC/IvyUDPStreamV3.cs
index 027789a..99fb87c 100644
--- a/CSharp/Ivy/IvyPPC/IvyUDPStreamV3.cs
+++ b/CSharp/Ivy/IvyPPC/IvyUDPStreamV3.cs
@@ -22,7 +22,7 @@ namespace IvyBus
}
/*
* message Syntax:
- * this is a binary formated message use of network representation
+ * this is a text formated message
*
* message Format:
protocol_version, TCP server port , appId, appName
@@ -55,6 +55,7 @@ namespace IvyBus
read = input.Read();
if (read < 0)
throw new EndOfStreamException();
+ if (read == 0) break;
car = (char)read;
if (car != sep)
str.Append(car);
@@ -64,12 +65,21 @@ namespace IvyBus
internal override void Deserialize(out ushort version, out ushort port, out string appId, out string appName)
{
+ version = 0;
+ port = 0;
+ appId = "";
+ appName = "";
+ try {
version = DeserializeShort();
port = DeserializeShort();
- //appId = DeserializeString(); //No AppId in V3
- //appName = DeserializeString('\n');
- appId = "";
- appName = "";
+ //Optionel in V3 protocol depend on client version
+ appId = DeserializeString(' ');
+ appName = DeserializeString('\n');
+ }
+ catch( EndOfStreamException e )
+ {
+ // Bad protocol message receive or without appId and appName
+ }
}
private void Serialize(ushort arg, char sep)
{
@@ -84,9 +94,9 @@ namespace IvyBus
internal override void Serialize(ushort port, string appId, string appName)
{
Serialize(PROCOCOLVERSION, ' ');
- Serialize(port,'\n');
- //Serialize(appId); //No AppId in V3
- //Serialize(appName, '\n'); //No Appname in V3
+ Serialize(port,' ');
+ Serialize(appId,' '); //No AppId in V3
+ Serialize(appName, '\n'); //No Appname in V3
output.Flush();
}
}