using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
namespace SuperSocket.Common
{
///
/// This class is designed for detect platform attribute in runtime
///
public static class Platform
{
static Platform()
{
try
{
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.IOControl(IOControlCode.KeepAliveValues, null, null);
SupportSocketIOControlByCodeEnum = true;
}
catch (NotSupportedException)
{
SupportSocketIOControlByCodeEnum = false;
}
catch (NotImplementedException)
{
SupportSocketIOControlByCodeEnum = false;
}
catch (Exception)
{
SupportSocketIOControlByCodeEnum = true;
}
Type t = Type.GetType("Mono.Runtime");
IsMono = t != null;
}
///
/// Gets a value indicating whether [support socket IO control by code enum].
///
///
/// true if [support socket IO control by code enum]; otherwise, false.
///
public static bool SupportSocketIOControlByCodeEnum { get; private set; }
///
/// Gets a value indicating whether this instance is mono.
///
///
/// true if this instance is mono; otherwise, false.
///
public static bool IsMono { get; private set; }
}
}