diff options
author | fcolin | 2007-02-01 10:03:28 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 10:03:28 +0000 |
commit | b248078ec6f9db57e7320b36d1718040266d8c37 (patch) | |
tree | 0e9cc114e26eaf8d99078439e5ba98d682bca271 | |
parent | 04790369fda05fa67a3004a4c7b7d6102f1d936c (diff) | |
download | ivy-csharp-b248078ec6f9db57e7320b36d1718040266d8c37.zip ivy-csharp-b248078ec6f9db57e7320b36d1718040266d8c37.tar.gz ivy-csharp-b248078ec6f9db57e7320b36d1718040266d8c37.tar.bz2 ivy-csharp-b248078ec6f9db57e7320b36d1718040266d8c37.tar.xz |
Utilisateur : Fcolin Date : 19/12/05 Heure : 16:54 Archivé dans $/CSharp/Ivy Commentaire: (vss 12)
-rw-r--r-- | CSharp/Ivy/IvyPPC/IvyWatcher.cs | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/CSharp/Ivy/IvyPPC/IvyWatcher.cs b/CSharp/Ivy/IvyPPC/IvyWatcher.cs index fd7f0ff..d5141f3 100644 --- a/CSharp/Ivy/IvyPPC/IvyWatcher.cs +++ b/CSharp/Ivy/IvyPPC/IvyWatcher.cs @@ -31,7 +31,7 @@ namespace IvyBus private int port;
private volatile Thread listenThread;
private IPAddress group;
- private IvyUDPStreamV4 stream;
+ private IvyUDPStream stream;
/// <summary> creates an Ivy watcher
/// </summary>
@@ -65,7 +65,11 @@ namespace IvyBus {
broadcast.SetSocketOption(SocketOptionLevel.Udp, SocketOptionName.AddMembership, new MulticastOption( group ));
}
- stream = new IvyUDPStreamV4(broadcast);
+ // TODO support the Two protocol
+ if (Properties.Settings.Default.IvyProtocolVersion == 4)
+ stream = new IvyUDPStreamV4(broadcast);
+ else
+ stream = new IvyUDPStreamV3(broadcast);
}
catch (IOException e)
{
@@ -86,9 +90,9 @@ namespace IvyBus {
try
{
-
- int version;
- int port;
+
+ ushort version;
+ ushort port;
string appId;
string appName;
IPEndPoint remoteEP;
@@ -99,14 +103,18 @@ namespace IvyBus //TODO if ( !isInDomain( remotehost ) ) continue;
- if (version != IvyUDPStreamV4.PROCOCOLVERSION)
+ if (version != stream.ProtocolVersion)
{
- Console.Error.WriteLine("Ignoring bad protocol version {0} expected {1}", version, IvyUDPStreamV4.PROCOCOLVERSION);
+ Console.WriteLine("Ignoring bad protocol version {0} expected {1}", version, stream.ProtocolVersion);
continue;
}
-
- if ( appId == bus.AppId ) // self Broadcast
+
+ // filtrage des self Broadcast
+ if ( appId == bus.AppId )
continue;
+ if ( (port == bus.applicationPort) && (remotehost.Equals(bus.applicationHost)) )
+ continue;
+
traceDebug("BUSWATCHER Broadcast de " + Dns.GetHostByAddress(remotehost).HostName + ":" + remoteEP.Port + " port " + port +
" version " + version +
" id " + appId +
@@ -200,7 +208,7 @@ namespace IvyBus {
int sep_index = net.LastIndexOf(":");
int port = (sep_index == - 1)?Ivy.DEFAULT_PORT:Int32.Parse(net.Substring(sep_index + 1));
- // out.println("net: ["+net+"]\nsep_index: "+sep_index+"\nport: "+port);
+ // Console.Writeline("net: ["+net+"]\nsep_index: "+sep_index+"\nport: "+port);
return port;
}
|