Using 0.0.0.0 as an address so server is reachable on all interfaces

This commit is contained in:
Egidijus Lileika 2021-03-12 10:49:54 +02:00
parent e542e790fd
commit 03edb539e3

View File

@ -24,8 +24,7 @@ namespace Cuipod
public App(string directoryToServe, string certificateFile, string privateRSAKeyFilePath) public App(string directoryToServe, string certificateFile, string privateRSAKeyFilePath)
{ {
_directoryToServe = directoryToServe; _directoryToServe = directoryToServe;
IPAddress localAddress = IPAddress.Parse("127.0.0.1"); _listener = new TcpListener(IPAddress.Any, 1965);
_listener = new TcpListener(localAddress, 1965);
_requestCallbacks = new Dictionary<string, RequestCallback>(); _requestCallbacks = new Dictionary<string, RequestCallback>();
_serverCertificate = CertificateUtils.LoadCertificate(certificateFile, privateRSAKeyFilePath); _serverCertificate = CertificateUtils.LoadCertificate(certificateFile, privateRSAKeyFilePath);
} }
@ -43,7 +42,7 @@ namespace Cuipod
public int Run() public int Run()
{ {
int status = 0; int status = 0;
Console.WriteLine("Serving capsule on 127.0.0.1:1965"); Console.WriteLine("Serving capsule on 0.0.0.0:1965");
try try
{ {
_listener.Start(); _listener.Start();