本文整理汇总了C#中IServer.Open方法的典型用法代码示例。如果您正苦于以下问题:C# IServer.Open方法的具体用法?C# IServer.Open怎么用?C# IServer.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServer
的用法示例。
在下文中一共展示了IServer.Open方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConnectivityTests
public ConnectivityTests()
{
_opts = new Options();
_opts.uris = new List<string>() {cURL};
_servers = new List<IServer>();
_log = Substitute.For<ILog>();
_server = Substitute.For<IServer>();
_server.URL.Returns(cURL);
_server.Open().Returns(Task<bool>.FromResult(true));
_servers.Add(_server);
_factory = Substitute.For<IFactory>();
_factory.NewServer(Arg.Any<string[]>()).Returns(_servers);
}
示例2: SubscribeTests
public SubscribeTests()
{
_opts = new Options();
_opts.uris = new List<string>() {cURL};
_servers = new List<IServer>();
_log = Substitute.For<ILog>();
_msgr = Substitute.For<IMessenger>();
_server = Substitute.For<IServer>();
_server.IsConnected.Returns(true);
_server.URL.Returns(cURL);
_server.Open().Returns(Task<bool>.FromResult(true));
_server.Send(Arg.Any<string>())
.Returns(Task<int>.FromResult(1))
.AndDoes(x => { _server.Sent += Raise.EventWith(new dotnet_sockets.EventArgs<int>(1)); });
_servers.Add(_server);
_factory = Substitute.For<IFactory>();
_factory.NewServer(Arg.Any<string[]>()).Returns(_servers);
_factory.NewMessenger().Returns(_msgr);
}
示例3: Open
public void Open()
{
LoadAppModule();
ModelInit();
MessageCenterInit();
try
{
PacketAnalyzer.Application = this;
PacketAnalyzer.MessageCenter = MessageCenter;
mServer = Beetle.Express.ServerFactory.CreateTCP();
mServer.Host = Host;
mServer.Port = Port;
NetHandler handler = new NetHandler();
handler.Application = this;
mServer.Handler = handler;
mServer.Open(mReceiveUseQueue, mSendUseQueue, mSyncSend, mReceiveThreads, mSendThreads, "EC");
"ec application started:[{2}@{3}] [message center:{0}] [packet analyzer:{1}]".Log4Info(MessageCenter.Name, PacketAnalyzer.Name, Host, Port);
if (LoadCompleted != null)
{
OnLoadCompleted(new EventApplicationArgs { Application = this });
}
}
catch (Exception e_)
{
"ec application start error".Log4Error(e_);
}
}