internal void Init()
{
#if DEBUG
// Don't want to bloat the code with excessive debugging information, unless this is a DEBUG build. jh
try
{
#endif
Handle = AsyncSocket.Create(AddressFamily.InterNetwork, SocketType.Rdm, PgmProtocolType);
#if DEBUG
}
catch (SocketException x)
{
string xMsg = string.Format("SocketException with ErrorCode={0}, SocketErrorCode={1}, Message={2}, in PgmSocket.Init, within AsyncSocket.Create(AddressFamily.InterNetwork, SocketType.Rdm, PGM_PROTOCOL_TYPE), {3}", x.ErrorCode, x.SocketErrorCode, x.Message, this);
Debug.WriteLine(xMsg);
// If running on Microsoft Windows, suggest to the developer that he may need to install MSMQ in order to get PGM socket support.
PlatformID p = Environment.OSVersion.Platform;
bool isWindows = true;
switch (p)
{
case PlatformID.Win32NT:
break;
case PlatformID.Win32S:
break;
case PlatformID.Win32Windows:
break;
default:
isWindows = false;
break;
}
if (isWindows)
{
Debug.WriteLine("For Microsoft Windows, you may want to check to see whether you have installed MSMQ on this host, to get PGM socket support.");
}
throw new FaultException(innerException: x, message: xMsg);
}
#endif
Handle.ExclusiveAddressUse = false;
Handle.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
}