summaryrefslogtreecommitdiff
path: root/CSharp/Ivy/IvyPPC
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:54:40 +0000
committerfcolin2007-02-01 09:54:40 +0000
commitf1c66f1be911336e947ba2acf3c324a82b4038be (patch)
tree2caf293c575730a93b8af22ac08db7a3a589b06c /CSharp/Ivy/IvyPPC
parent2a8d06db7f7764a8d5e62daaff1226576107c44b (diff)
downloadivy-csharp-f1c66f1be911336e947ba2acf3c324a82b4038be.zip
ivy-csharp-f1c66f1be911336e947ba2acf3c324a82b4038be.tar.gz
ivy-csharp-f1c66f1be911336e947ba2acf3c324a82b4038be.tar.bz2
ivy-csharp-f1c66f1be911336e947ba2acf3c324a82b4038be.tar.xz
Utilisateur : Fcolin Date : 5/02/04 Heure : 15:56 Archivé dans $/EScribe/Ivy Commentaire: (vss 22)
Diffstat (limited to 'CSharp/Ivy/IvyPPC')
-rw-r--r--CSharp/Ivy/IvyPPC/Ivy.cs25
1 files changed, 23 insertions, 2 deletions
diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs
index 8775944..ec4e401 100644
--- a/CSharp/Ivy/IvyPPC/Ivy.cs
+++ b/CSharp/Ivy/IvyPPC/Ivy.cs
@@ -105,6 +105,26 @@ namespace IvyBus
}
}
+ internal class MyTcpListener : TcpListener
+ {
+ public MyTcpListener(IPAddress address, int port) : base(address, port)
+ {
+ //Socket s = this.Server;
+ // set Listen MaxConnections to 10 .
+ //IPOptions lingerOption = new IPOptions (true, 10);
+
+ //s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MaxConnections , 10 );
+ }
+ public void WaitForActive()
+ {
+ while( ! this.Active )
+ {
+ Thread.Sleep( 50 );
+ }
+ }
+
+
+ }
/// the name of the application on the bus
internal String appName;
@@ -118,7 +138,7 @@ namespace IvyBus
private bool debug;
private static int serial = 0; /* an unique ID for each regexp */
- private TcpListener app;
+ private MyTcpListener app;
private ArrayList watchers;
private volatile Thread serverThread; // to ensure quick communication of the end
private Hashtable callbacks;
@@ -194,7 +214,7 @@ namespace IvyBus
domainbus = DEFAULT_DOMAIN;
try
{
- app = new TcpListener(0);
+ app = new MyTcpListener(IPAddress.Any,0);
app.Start();
applicationPort = ((IPEndPoint) app.LocalEndpoint).Port;
}
@@ -215,6 +235,7 @@ namespace IvyBus
serverThread = new Thread(new ThreadStart(this.Run));
serverThread.Name = "Ivy Tcp Server Thread";
serverThread.Start();
+ app.WaitForActive();
// sends the broadcasts and listen to incoming connexions
for (int i = 0; i < watchers.Count; i++)
{