diff options
author | fcolin | 2007-02-01 10:03:48 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 10:03:48 +0000 |
commit | 2a18d2c886bd31ffc52cfc7f79e85a2d96037936 (patch) | |
tree | 5ce5697593e30e683011e1833df4f9aa57741d0b /CSharp | |
parent | 8dd785d35748a96d56f6a79939bdc5a650085c5e (diff) | |
download | ivy-csharp-2a18d2c886bd31ffc52cfc7f79e85a2d96037936.zip ivy-csharp-2a18d2c886bd31ffc52cfc7f79e85a2d96037936.tar.gz ivy-csharp-2a18d2c886bd31ffc52cfc7f79e85a2d96037936.tar.bz2 ivy-csharp-2a18d2c886bd31ffc52cfc7f79e85a2d96037936.tar.xz |
Utilisateur : Fcolin Date : 10/02/06 Heure : 15:34 Archivé dans $/CSharp/Ivy/Ivy Commentaire: symplification traitement exception (vss 22)
Diffstat (limited to 'CSharp')
-rw-r--r-- | CSharp/Ivy/IvyPPC/IvyWatcher.cs | 82 |
1 files changed, 35 insertions, 47 deletions
diff --git a/CSharp/Ivy/IvyPPC/IvyWatcher.cs b/CSharp/Ivy/IvyPPC/IvyWatcher.cs index b943b21..0db24aa 100644 --- a/CSharp/Ivy/IvyPPC/IvyWatcher.cs +++ b/CSharp/Ivy/IvyPPC/IvyWatcher.cs @@ -90,57 +90,45 @@ namespace IvyBus bool running = true;
while (running)
{
- try
- {
+ ushort version;
+ ushort port;
+ string appId;
+ string appName;
+ IPEndPoint remoteEP;
- ushort version;
- ushort port;
- string appId;
- string appName;
- IPEndPoint remoteEP;
-
- stream.receiveMsg(out remoteEP, out version,out port,out appId,out appName);
- IPAddress remotehost = remoteEP.Address;
- traceDebug("BUSWATCHER Receive Broadcast from " + Dns.GetHostEntry(remotehost).HostName + ":" + remoteEP.Port);
+ stream.receiveMsg(out remoteEP, out version, out port, out appId, out appName);
+ IPAddress remotehost = remoteEP.Address;
+ traceDebug("BUSWATCHER Receive Broadcast from " + Dns.GetHostEntry(remotehost).HostName + ":" + remoteEP.Port);
- //TODO if ( !isInDomain( remotehost ) ) continue;
+ //TODO if ( !isInDomain( remotehost ) ) continue;
- if (version != stream.ProtocolVersion)
- {
- traceDebug("Ignoring bad protocol version "+ version + " expected " + stream.ProtocolVersion);
- continue;
- }
+ if (version != stream.ProtocolVersion)
+ {
+ traceDebug("Ignoring bad protocol version " + version + " expected " + stream.ProtocolVersion);
+ continue;
+ }
- // filtrage des self Broadcast
- if ( appId == bus.AppId )
- continue;
- if ( (port == bus.applicationPort) && (remotehost.Equals(bus.applicationHost)) )
- continue;
- traceDebug("BUSWATCHER reponse au Broadcast de " + Dns.GetHostEntry(remotehost).HostName + ":" + remoteEP.Port + " port " + port +
- " version " + version +
- " id " + appId +
- " name " + appName);
- try
- {
- Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- IPEndPoint hostEndPoint = new IPEndPoint(remoteEP.Address, port);
- socket.Connect(hostEndPoint);
- bus.addClient(socket,appName);
- }
- catch (Exception e)
- {
- traceDebug("can't connect to " + remotehost + " port " + port + " \n" + e.Message);
- }
- }
- catch (IOException jii)
- {
- traceDebug("UDP listener " + jii.Message);
- running = false;
- }
-// catch (SocketException se)
-// {
-// traceDebug( "watcher socket closed: " + se.Message);
-// }
+ // filtrage des self Broadcast
+ if (appId == bus.AppId)
+ continue;
+ if ((port == bus.applicationPort) && (remotehost.Equals(bus.applicationHost)))
+ continue;
+ traceDebug("BUSWATCHER reponse au Broadcast de " + Dns.GetHostEntry(remotehost).HostName + ":" + remoteEP.Port + " port " + port +
+ " version " + version +
+ " id " + appId +
+ " name " + appName);
+ try
+ {
+ Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ IPEndPoint hostEndPoint = new IPEndPoint(remoteEP.Address, port);
+ socket.Connect(hostEndPoint);
+ bus.addClient(socket, appName);
+ }
+ catch (Exception e)
+ {
+ traceDebug("can't connect to " + remotehost + " port " + port + " \n" + e.Message);
+ }
+
} // while
}
catch (SocketException se)
|