Add echoDelay param to SimpleTCPServer
This commit is contained in:
1 parent
6f931a1b0c
commit
a8b2eab935
4 files changed
+26
-8
No files matched your search
@@ -17,9 +17,10 @@ Parser.Default.ParseArguments<PubSubServerConfig>(args)
|
||||
|
||||
int Run(PubSubServerConfig cfg) {
|
||||
try {
|
||||
cfg.MergeWithConfigFile();
|
||||
Configuration.initialize();
|
||||
return cfg.SimpleEchoServer ?? false ?
|
||||
RunEchoServer(cfg.Port ?? 12345) :
|
||||
RunEchoServer(cfg.Port ?? 12345, cfg.EchoDelay) :
|
||||
RunPubSubServer(cfg);
|
||||
} catch (Exception ex) {
|
||||
// Write the error to console first, in case the logging system is compromised.
|
||||
@@ -52,11 +53,11 @@ int RunPubSubServer(PubSubServerConfig cfg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RunEchoServer(short port) {
|
||||
int RunEchoServer(short port, TimeSpan? echoDelay) {
|
||||
Console.WriteLine("Running as TCP Echo server, Hit enter to continue");
|
||||
Console.ReadLine();
|
||||
Console.WriteLine($"ready to listen to port: {port}");
|
||||
var sts = new SimpleTCPServer(port);
|
||||
var sts = new SimpleTCPServer(port, echoDelay);
|
||||
sts.init();
|
||||
Console.CancelKeyPress += OnCancelKeyPress;
|
||||
while (true) {
|
||||
|
||||
Reference in new issue
Block a user