本文整理汇总了C#中Server.addHTTPResponsibility方法的典型用法代码示例。如果您正苦于以下问题:C# Server.addHTTPResponsibility方法的具体用法?C# Server.addHTTPResponsibility怎么用?C# Server.addHTTPResponsibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server.addHTTPResponsibility方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static int Main(String[] args)
{
ServerConfiguration config = new ServerConfiguration();
Server server = new Server(config);
server.OnServerNotify += new Server.ServerNotify(serverOut);
server.addHTTPResponsibility(new ElseResponsibility());
server.addHTTPResponsibility(new RunningResponsibility());
server.startServing();
Console.Read();
server.stopServing();
return 0;
}
示例2: startDataLink
private static void startDataLink()
{
if (server == null)
{
try
{
PluginLogger.print("Telemachus data link starting");
readConfiguration();
server = new Server(serverConfig);
server.OnServerNotify += new Server.ServerNotify(serverOut);
server.addHTTPResponsibility(new ElseResponsibility());
ioPageResponsibility = new IOPageResponsibility();
server.addHTTPResponsibility(ioPageResponsibility);
dataLinkResponsibility = new DataLinkResponsibility(JSONFormatterProvider.Instance, serverConfig);
server.addHTTPResponsibility(dataLinkResponsibility);
server.startServing();
PluginLogger.print("Telemachus data link listening for requests on the following addresses: ("
+ server.getIPsAsString() +
"). Try putting them into your web browser, some of them might not work.");
}
catch (Exception e)
{
PluginLogger.print(e.Message);
PluginLogger.print(e.StackTrace);
}
}
}
示例3: startDataLink
private static void startDataLink()
{
if (server == null)
{
try
{
PluginLogger.print("Telemachus data link starting");
readConfiguration();
server = new Server(serverConfig);
server.ServerNotify += HTTPServerNotify;
server.addHTTPResponsibility(new ElseResponsibility());
ioPageResponsibility = new IOPageResponsibility();
server.addHTTPResponsibility(ioPageResponsibility);
vesselChangeDetector = new VesselChangeDetector();
dataLinkResponsibility = new DataLinkResponsibility(serverConfig, new KSPAPI(JSONFormatterProvider.Instance, vesselChangeDetector, serverConfig));
server.addHTTPResponsibility(dataLinkResponsibility);
Servers.MinimalWebSocketServer.ServerConfiguration webSocketconfig = new Servers.MinimalWebSocketServer.ServerConfiguration();
webSocketconfig.bufferSize = 300;
webSocketServer = new Servers.MinimalWebSocketServer.Server(webSocketconfig);
webSocketServer.ServerNotify += WebSocketServerNotify;
kspWebSocketService = new KSPWebSocketService(new KSPAPI(JSONFormatterProvider.Instance, vesselChangeDetector, serverConfig));
webSocketServer.addWebSocketService("/datalink", kspWebSocketService);
webSocketServer.subscribeToHTTPForStealing(server);
server.startServing();
PluginLogger.print("Telemachus data link listening for requests on the following addresses: ("
+ server.getIPsAsString() +
"). Try putting them into your web browser, some of them might not work.");
}
catch (Exception e)
{
PluginLogger.print(e.Message);
PluginLogger.print(e.StackTrace);
}
}
}