本文整理汇总了C#中IServer.Listen方法的典型用法代码示例。如果您正苦于以下问题:C# IServer.Listen方法的具体用法?C# IServer.Listen怎么用?C# IServer.Listen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServer
的用法示例。
在下文中一共展示了IServer.Listen方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public void Start()
{
_scheduler = KayakScheduler.Factory.Create(new SchedulerDelegate());
_server = KayakServer.Factory.CreateHttp(new RequestDelegate(Port, Title, FilePaths, ImagePath), _scheduler);
_server.Listen(new IPEndPoint(IPAddress.Any, Port));
_scheduler.Start();
}
示例2: Start
public void Start()
{
m_Scheduler = KayakScheduler.Factory.Create(new SchedulerDelegate());
m_Server = KayakServer.Factory.CreateHttp(new NancyRequestDelegate(m_Engine), m_Scheduler);
IDisposable disposable = m_Server.Listen(m_EndPoint);
Thread schedulerWorkerThread = new Thread(SchedulerWorker);
schedulerWorkerThread.IsBackground = true;
schedulerWorkerThread.Start(disposable);
m_Scheduler.Post(GetLocalPort);
}
示例3: Run
public void Run()
{
IsRunning = true;
_messageManager = new MessageManager(Encryptor);
try
{
_server = new ServerTcp(Address, Port, _messageManager);
_server.NewClientEvent += ClientConnected_EventHandler;
RunConnectionCheckTask();
_server.Listen();
}
catch (SocketException e)
{
StopRunning();
throw;
}
}
示例4: _SetServerEnableState
private void _SetServerEnableState(bool value, int port)
{
if (value) {
if (server != null) _SetServerEnableState(false, port);
server = KayakServer.Factory.CreateHttp(new RequestDelegate(), scheduler);
server.Listen(new IPEndPoint(IPAddress.Any, port));
LiveSystemContext = VixenSystem.Contexts.GetSystemLiveContext();
Thread T = new Thread(new ThreadStart(scheduler.Start));
T.Start();
} else {
scheduler.Stop();
if (server != null) {
server.Dispose();
server = null;
}
LiveSystemContext = null;
}
}
示例5: RunApplication
public void RunApplication(int port, Action<FubuRuntime> activation)
{
_port = port;
_listeningEndpoint = new IPEndPoint(IPAddress.Any, _port);
Console.WriteLine("Listening on " + _listeningEndpoint);
_applicationDelegate = AppBuilder.BuildConfiguration(x => x.RescheduleCallbacks().Run(ExecuteRequest));
_scheduler = KayakScheduler.Factory.Create(_schedulerDelegate);
_server = KayakServer.Factory.CreateGate(_applicationDelegate, _scheduler, null);
if (_listeningEndpoint == null)
{
throw new InvalidOperationException("Start() can only be called after RunApplication() and Stop()");
}
var runtime = rebuildFubuMVCApplication();
_kayakListenerDisposer = _server.Listen(_listeningEndpoint);
_scheduler.Post(() => ThreadPool.QueueUserWorkItem(o => activation(runtime)));
_scheduler.Start();
}
示例6: _SetServerEnableState
private void _SetServerEnableState(bool value, int port)
{
if (value) {
if (server != null) _SetServerEnableState(false, port);
server = KayakServer.Factory.CreateHttp(new RequestDelegate(), scheduler);
server.Listen(new IPEndPoint(IPAddress.Any, port));
LiveContext = VixenSystem.Contexts.CreateLiveContext("Web Server");
LiveContext.Start();
Thread T = new Thread(new ThreadStart(scheduler.Start));
T.Start();
} else {
scheduler.Stop();
if (server != null) {
server.Dispose();
server = null;
}
if (LiveContext != null)
{
//We are the only current consumer of LiveContext, so shut it off when we are done.
VixenSystem.Contexts.ReleaseContext(LiveContext);
LiveContext = null;
}
}
}