-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathProgram.cs
More file actions
33 lines (30 loc) · 1.18 KB
/
Copy pathProgram.cs
File metadata and controls
33 lines (30 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Runtime.CompilerServices;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace ChannelWSServer
{
public class Program
{
public const int TIMESTAMP_INTERVAL_SEC = 15;
public const int BROADCAST_TRANSMIT_INTERVAL_MS = 250;
public const int CLOSE_SOCKET_TIMEOUT_MS = 2500;
public static void Main(string[] args)
{
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseUrls(new string[] { @"http://localhost:8080/" });
webBuilder.UseStartup<Startup>();
})
.Build()
.Run();
}
// should use a logger but hey, it's a demo and it's free
public static void ReportException(Exception ex, [CallerMemberName]string location = "(Caller name not set)")
{
Console.WriteLine($"\n{location}:\n Exception {ex.GetType().Name}: {ex.Message}");
if (ex.InnerException != null) Console.WriteLine($" Inner Exception {ex.InnerException.GetType().Name}: {ex.InnerException.Message}");
}
}
}