summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2007-02-01 10:03:00 +0000
committerfcolin2007-02-01 10:03:00 +0000
commit8b81e883a032ee2e728d621563398738c4cc1967 (patch)
treeb41c1b7f3c3f215eb63b760288016bb7fd62ebc7
parent05c0964e20db84a666457253a948c2df995b3093 (diff)
downloadivy-csharp-8b81e883a032ee2e728d621563398738c4cc1967.zip
ivy-csharp-8b81e883a032ee2e728d621563398738c4cc1967.tar.gz
ivy-csharp-8b81e883a032ee2e728d621563398738c4cc1967.tar.bz2
ivy-csharp-8b81e883a032ee2e728d621563398738c4cc1967.tar.xz
Utilisateur : Fcolin Date : 30/11/05 Heure : 10:27 Archivé dans $/CSharp/Ivy Commentaire: (vss 2)
-rw-r--r--CSharp/Ivy/IvyPPC/IvyUDPStreamV4.cs17
1 files changed, 13 insertions, 4 deletions
diff --git a/CSharp/Ivy/IvyPPC/IvyUDPStreamV4.cs b/CSharp/Ivy/IvyPPC/IvyUDPStreamV4.cs
index d5319c8..8eebecd 100644
--- a/CSharp/Ivy/IvyPPC/IvyUDPStreamV4.cs
+++ b/CSharp/Ivy/IvyPPC/IvyUDPStreamV4.cs
@@ -16,6 +16,8 @@ namespace IvyBus
MemoryStream out_stream;
MemoryStream in_stream;
+ /// the protocol version number
+ internal const int PROCOCOLVERSION = 4;
public IvyUDPStream(Socket _socket)
{
socket = _socket;
@@ -25,6 +27,13 @@ namespace IvyBus
out_stream = new MemoryStream();
output = new BinaryWriter(out_stream, Encoding.ASCII);
}
+ /*
+ * message Syntax:
+ * this is a binary formated message use of network representation
+ *
+ * message Format:
+ protocol_version, TCP server port , lenAppId, appId, lenAppNameId, appName
+ */
internal void receiveMsg(out IPEndPoint remote, out int version, out int port, out string appId, out string appName)
{
@@ -39,14 +48,14 @@ namespace IvyBus
port = (ushort)IPAddress.NetworkToHostOrder((short)input.ReadUInt16());
int lenAppId = (ushort)IPAddress.NetworkToHostOrder((short)input.ReadUInt16());
appId = new String(input.ReadChars(lenAppId));
- int lenAppNameId = (ushort)IPAddress.NetworkToHostOrder((short)input.ReadUInt16());
- appName = new String(input.ReadChars(lenAppNameId));
+ int lenAppName = (ushort)IPAddress.NetworkToHostOrder((short)input.ReadUInt16());
+ appName = new String(input.ReadChars(lenAppName));
}
internal void sendMsg(IPEndPoint EPhost, int port, string appId, string appName)
{
- output.Write((ushort)IPAddress.HostToNetworkOrder((short)(Ivy.PROCOCOLVERSION)));
+ output.Write((ushort)IPAddress.HostToNetworkOrder((short)(PROCOCOLVERSION)));
output.Write((ushort)IPAddress.HostToNetworkOrder((short)port));
output.Write((ushort)IPAddress.HostToNetworkOrder((short)appId.Length));
output.Write(appId.ToCharArray());
@@ -55,7 +64,7 @@ namespace IvyBus
output.Flush();
byte[] hellob = out_stream.GetBuffer();
- socket.SendTo(hellob, (int)out_stream.Length, 0, EPhost); // notifies our arrival on each domain: protocol version + port
+ socket.SendTo(hellob, (int)out_stream.Length, 0, EPhost);
}
internal void Close()
{