本文整理汇总了C#中IServerConfig类的典型用法代码示例。如果您正苦于以下问题:C# IServerConfig类的具体用法?C# IServerConfig怎么用?C# IServerConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IServerConfig类属于命名空间,在下文中一共展示了IServerConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Setup
/// <summary>
/// Setups the specified root config.
/// </summary>
/// <param name="bootstrap">The bootstrap.</param>
/// <param name="config">The socket server instance config.</param>
/// <param name="factories">The factories.</param>
/// <returns></returns>
public bool Setup(IBootstrap bootstrap, IServerConfig config, ProviderFactoryInfo[] factories)
{
m_Bootstrap = bootstrap;
m_ServerConfig = config;
m_Factories = factories;
return true;
}
开发者ID:kinghuc,项目名称:521266750_qq_com,代码行数:14,代码来源:AppDomainAppServer.cs
示例2: GetAppServerMetadata
protected override AppServerMetadata GetAppServerMetadata(IServerConfig serverConfig)
{
AppDomain validateDomain = null;
AppServerMetadata metadata = null;
try
{
validateDomain = AppDomain.CreateDomain("ValidationDomain", AppDomain.CurrentDomain.Evidence, serverConfig.Options.Get("appWorkingDir") ?? IsolationApp.GetAppWorkingDir(serverConfig.Name), string.Empty, false);
AssemblyImport.RegisterAssembplyImport(validateDomain);
validateDomain.SetData(typeof(IsolationMode).Name, ConfigSource.Isolation);
var validatorType = typeof(RemoteAppTypeValidator);
var validator = (RemoteAppTypeValidator)validateDomain.CreateInstanceAndUnwrap(validatorType.Assembly.FullName, validatorType.FullName);
var result = validator.GetServerMetadata(serverConfig.Type);
if(!result.Result)
{
Logger.Error(result.Message);
return null;
}
metadata = result.Value;
}
finally
{
if (validateDomain != null)
AppDomain.Unload(validateDomain);
}
return metadata;
}
开发者ID:weitaoxiao,项目名称:NDock,代码行数:34,代码来源:IsolationBootstrap.cs
示例3: Composite
private bool Composite(IServerConfig config)
{
CompositionContainer = GetCompositionContainer(config);
//Fill the imports of this object
try
{
var targets = new List<ICompositeTarget>();
RegisterCompositeTarget(targets);
if (targets.Any())
{
foreach (var t in targets)
{
if(!t.Resolve(this, CompositionContainer))
{
throw new Exception("Failed to resolve the instance of the type: " + t.GetType().FullName);
}
}
}
return true;
}
catch(Exception e)
{
var logger = Logger;
if (logger == null)
throw e;
logger.Error("Composition error", e);
return false;
}
}
开发者ID:weitaoxiao,项目名称:NDock,代码行数:34,代码来源:AppServer.cs
示例4: Start
/// <summary>
/// Starts to listen
/// </summary>
/// <param name="config">The server config.</param>
/// <returns></returns>
public override bool Start(IServerConfig config)
{
try
{
m_ListenSocket = new Socket(this.EndPoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
m_ListenSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
m_ListenSocket.Bind(this.EndPoint);
//Mono doesn't support it
if (Platform.SupportSocketIOControlByCodeEnum)
{
uint IOC_IN = 0x80000000;
uint IOC_VENDOR = 0x18000000;
uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12;
byte[] optionInValue = { Convert.ToByte(false) };
byte[] optionOutValue = new byte[4];
m_ListenSocket.IOControl((int)SIO_UDP_CONNRESET, optionInValue, optionOutValue);
}
var eventArgs = m_SaePool.Get();
m_ListenSocket.ReceiveFromAsync(eventArgs);
return true;
}
catch (Exception e)
{
OnError(e);
return false;
}
}
开发者ID:haylax,项目名称:SuperSocket,代码行数:37,代码来源:UdpSocketListener.cs
示例5: Setup
public virtual bool Setup(IBootstrap bootstrap, IServerConfig config)
{
Bootstrap = bootstrap;
var loggerProvider = bootstrap as ILoggerProvider;
if (loggerProvider != null)
Logger = loggerProvider.Logger;
State = ServerState.Initializing;
Config = config;
Name = config.Name;
State = ServerState.NotStarted;
AppWorkingDir = config.Options.Get("appWorkingDir") ?? GetAppWorkingDir(Name);
if (!Directory.Exists(AppWorkingDir))
Directory.CreateDirectory(AppWorkingDir);
var appConfigFilePath = GetAppConfigFile();
// use the application's own config file if it has
//AppRoot\AppName\App.config
if (!string.IsNullOrEmpty(appConfigFilePath))
StartupConfigFile = appConfigFilePath;
m_NotStartedStatus = new Lazy<StatusInfoCollection>(() =>
{
var status = new StatusInfoCollection(m_Metadata.Name);
status[StatusInfoKeys.IsRunning] = false;
return status;
});
return true;
}
开发者ID:weitaoxiao,项目名称:NDock,代码行数:35,代码来源:IsolationApp.cs
示例6: Start
/// <summary>
/// 启动监听
/// </summary>
/// <param name="config">服务器配置</param>
/// <returns></returns>
public override bool Start(IServerConfig config)
{
m_ListenSocket = new System.Net.Sockets.Socket(this.Info.EndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
try
{
//关联终结地
m_ListenSocket.Bind(this.Info.EndPoint);
//设置监听最大连接数
m_ListenSocket.Listen(m_ListenBackLog);
m_ListenSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
m_ListenSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontLinger, true);
//初始化套接字操作
SocketAsyncEventArgs acceptEventArg = new SocketAsyncEventArgs();
m_AcceptSAE = acceptEventArg;
//定义一个连接完成事件
acceptEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(acceptEventArg_Completed);
if (!m_ListenSocket.AcceptAsync(acceptEventArg))
{
ProcessAccept(acceptEventArg);
}
return true;
}
catch (Exception e)
{
OnError(e);
return false;
}
}
开发者ID:babywzazy,项目名称:Server,代码行数:36,代码来源:TcpAsyncSocketListener.cs
示例7: ConfigInfo
public ConfigInfo(IServerConfig serverConfig, ClientConfiguration clientConfig)
{
ServerConfig = serverConfig;
ClientConfig = clientConfig;
CreationTime = DateTime.Now;
Initialize();
}
开发者ID:hyah,项目名称:couchbase-net-client,代码行数:7,代码来源:ConfigInfo.cs
示例8: ReportPotentialConfigChange
public void ReportPotentialConfigChange(IServerConfig config)
{
foreach (var item in Items)
{
item.ReportPotentialConfigChange(config);
}
}
开发者ID:weitaoxiao,项目名称:NDock,代码行数:7,代码来源:RemoteAppGroup.cs
示例9: SetUp
public void SetUp() {
serverConfig = A.Fake<IServerConfig>();
directoryEntryFactory = A.Fake<IDirectoryEntryFactory>();
filterBuilde = new FilterBuilder(serverConfig);
nameParser = new NameParser();
adapter = new DirectoryEntryAdapter(serverConfig, directoryEntryFactory, filterBuilde, nameParser);
}
开发者ID:aelveborn,项目名称:njupiter,代码行数:7,代码来源:DirectoryEntryAdapterTests.cs
示例10: Start
/// <summary>
/// Starts to listen
/// </summary>
/// <param name="config">The server config.</param>
/// <returns></returns>
public override bool Start(IServerConfig config)
{
try
{
m_ListenSocket = new Socket(this.EndPoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
m_ListenSocket.Bind(this.EndPoint);
uint IOC_IN = 0x80000000;
uint IOC_VENDOR = 0x18000000;
uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12;
byte[] optionInValue = { Convert.ToByte(false) };
byte[] optionOutValue = new byte[4];
m_ListenSocket.IOControl((int)SIO_UDP_CONNRESET, optionInValue, optionOutValue);
var eventArgs = new SocketAsyncEventArgs();
eventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(eventArgs_Completed);
eventArgs.RemoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
int receiveBufferSize = config.ReceiveBufferSize <= 0 ? 2048 : config.ReceiveBufferSize;
var buffer = new byte[receiveBufferSize];
eventArgs.SetBuffer(buffer, 0, buffer.Length);
m_ListenSocket.ReceiveFromAsync(eventArgs);
return true;
}
catch (Exception e)
{
OnError(e);
return false;
}
}
开发者ID:wulinfeng2008,项目名称:SuperSocket,代码行数:39,代码来源:UdpSocketListener.cs
示例11: Start
/// <summary>
/// Starts to listen
/// </summary>
/// <param name="config">The server config.</param>
/// <returns></returns>
public override bool Start(IServerConfig config)
{
m_ListenSocket = new Socket(this.Info.EndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
try
{
m_ListenSocket.Bind(this.Info.EndPoint);
m_ListenSocket.Listen(m_ListenBackLog);
m_ListenSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
m_ListenSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontLinger, true);
//
m_ListenSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
SocketAsyncEventArgs acceptEventArg = new SocketAsyncEventArgs();
acceptEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(acceptEventArg_Completed);
if (!m_ListenSocket.AcceptAsync(acceptEventArg))
ProcessAccept(acceptEventArg);
return true;
}
catch (Exception e)
{
OnError(e);
return false;
}
}
开发者ID:kinghuc,项目名称:521266750_qq_com,代码行数:34,代码来源:TcpAsyncSocketListener.cs
示例12: Init
public override bool Init(FtpServer server, IServerConfig config)
{
if (!base.Init(server, config))
return false;
var userSettingFile = config.Options.GetValue("userSetting");
if (string.IsNullOrEmpty(userSettingFile))
{
server.Logger.Error("No user setting file was not defined!");
return false;
}
if (!Path.IsPathRooted(userSettingFile))
userSettingFile = server.GetFilePath(userSettingFile);
if (!File.Exists(userSettingFile))
{
AppServer.Logger.Error("The userSetting file cannot be found!");
return false;
}
m_UserConfigFile = userSettingFile;
ReadUserConfigFile();
m_UserConfigReadTimer = new Timer(OnUserConfigReadTimerCallback, null, Timeout.Infinite, Timeout.Infinite);
return true;
}
开发者ID:zyh329,项目名称:SuperSocket.FtpServer,代码行数:30,代码来源:XmlFtpProvider.cs
示例13: AddNewServer
bool IDynamicBootstrap.AddAndStart(IServerConfig config)
{
var newWorkItem = AddNewServer(config);
if (newWorkItem == null)
return false;
return newWorkItem.Start();
}
开发者ID:zesus19,项目名称:c5.v1,代码行数:9,代码来源:DefaultBootstrap.Net40.cs
示例14: ClusterManager
internal ClusterManager(ClientConfiguration clientConfig, IServerConfig serverConfig, HttpClient httpClient, IDataMapper mapper, string username, string password)
{
_clientConfig = clientConfig;
_serverConfig = serverConfig;
Mapper = mapper;
HttpClient = httpClient;
_password = password;
_username = username;
}
开发者ID:kendallb,项目名称:couchbase-net-client,代码行数:9,代码来源:ClusterManager.cs
示例15: CreateAppInstance
protected override IManagedApp CreateAppInstance(IServerConfig serverConfig)
{
var appFile = serverConfig.Options.Get("appFile");
if(string.IsNullOrEmpty(appFile))
return base.CreateAppInstance(serverConfig);
var serverMetadata = new ExternalProcessAppServerMetadata(serverConfig.Options.Get("appDir"), appFile, serverConfig.Options.Get("appArgs"));
return new ExternalProcessApp(serverMetadata, ConfigFilePath);
}
开发者ID:weitaoxiao,项目名称:NDock,代码行数:10,代码来源:ProcessBootstrap.cs
示例16: Setup
protected override bool Setup(IManagedApp managedApp, IServerConfig config)
{
var ret = managedApp.Setup(m_RemoteBootstrapWrap, config);
if (!ret)
return false;
SetupRecycleTriggers(managedApp, config);
return ret;
}
开发者ID:kerryjiang,项目名称:NRack,代码行数:10,代码来源:IsolationBootstrap.cs
示例17: Setup
protected override bool Setup(IManagedApp managedApp, IServerConfig config)
{
var ret = base.Setup(managedApp, config);
if (!ret)
return false;
SetupRecycleTriggers(managedApp, config);
return ret;
}
开发者ID:Nokecy,项目名称:NDock,代码行数:10,代码来源:IsolationBootstrap.cs
示例18: Initialize
public void Initialize(IServerConfig config)
{
Config = config;
BindInterface = config.BindInterface;
Port = config.Port;
Initialize();
ProcessRequest += ProcessHttpRequest;
_logger.Information("Getwork server listening on {0:l}:{1}", BindInterface, Port);
}
开发者ID:carloslozano,项目名称:CoiniumServ,代码行数:11,代码来源:GetworkServer.cs
示例19: Initialize
/// <summary>
/// Initializes the specified pool.
/// </summary>
/// <param name="config">The configuration.</param>
public void Initialize(IServerConfig config)
{
Config = config;
BindIP = config.BindInterface;
Port = config.Port;
ClientConnected += StratumServer_ClientConnected;
ClientDisconnected += StratumServer_ClientDisconnected;
DataReceived += StratumServer_DataReceived;
}
开发者ID:nuggetbram,项目名称:CoiniumServ,代码行数:15,代码来源:StratumServer.cs
示例20: Controller
public Controller(IReworkStation reworkStation, IProgramStorage programStorage, IProgramRunStorage programRunStorage, IServerConfig serverConfig)
{
Get["/programs"] = _ =>
{
Console.WriteLine("Getting programs.");
return JArray.FromObject(programStorage.GetPrograms()).ToString();
};
Post["/programs"] = _ =>
{
Console.WriteLine("Updating programs.");
programStorage.UpdatePrograms(this.Bind<List<Pc900Program>>());
return @"{""status"":""OK""}";
};
Post["/delete-programs"] = _ =>
{
Console.WriteLine("Deleting programs.");
programStorage.DeletePrograms(this.Bind<List<Pc900Program>>());
return @"{""status"":""OK""}";
};
Post["/start-program/{programId}"] = path =>
{
Console.WriteLine("Starting program "+ path.programId.Value + ".");
var pc900ProgramRuns = programRunStorage.GetProgramRuns();
if (pc900ProgramRuns.Count > 0)
{
return JObject.FromObject(pc900ProgramRuns[0]).ToString();
}
Pc900Program program = programStorage.GetProgram(path.programId.Value);
var programRun = reworkStation.Start(program);
programRunStorage.AddProgramRun(programRun);
var achiPoller = new AchiPoller(reworkStation, programRunStorage);
_poller = new Timer(poll =>
{
if (achiPoller.PollWorker(null))
{
_poller.Dispose();
}
}, null, 1000, serverConfig.GetProgramRunPollingIntervalMillis());
return JObject.FromObject(programRun).ToString();
};
Get["/current-run/after-point/{afterPoint}"] = path => JObject.FromObject(programRunStorage.GetProgramRuns()[0].CreatePartial(int.Parse(path.afterPoint.Value))).ToString();
Get["/current-run"] = _ =>
{
var pc900ProgramRuns = programRunStorage.GetProgramRuns();
if (pc900ProgramRuns.Count > 0)
{
return JObject.FromObject(pc900ProgramRuns[0]).ToString();
}
return JObject.FromObject(new Pc900ProgramRun("1234", false)).ToString();
};
}
开发者ID:gareth-smyth,项目名称:achiir6500,代码行数:54,代码来源:Controller.cs
注:本文中的IServerConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论