static IdGenerator()
{
String stub = "-1-" + DateTime.Now.Ticks;
hostName = "localhost";
try
{
hostName = Dns.GetHostName();
IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, 0);
Socket tempSocket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
tempSocket.Bind(endPoint);
stub = "-" + ((IPEndPoint)tempSocket.LocalEndPoint).Port + "-" + DateTime.Now.Ticks + "-";
Thread.Sleep(100);
tempSocket.Close();
}
catch(Exception ioe)
{
Tracer.Warn("could not generate unique stub: " + ioe.Message);
}
UNIQUE_STUB = stub;
}