Skip to content

Commit

Permalink
Use the same port for all network interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienwarin committed Nov 15, 2019
1 parent fc43020 commit 0188e60
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions DeveloperToolsForUPnPTechnologies/UPnP/UPnPDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,6 @@ private void NewDeviceInterface(NetworkInfo sender, IPAddress ip)
{
try
{
//String tmp = ip.ToString();

MiniWebServer WebServer;
WebServer = new MiniWebServer(new IPEndPoint(ip, UseThisPort));
if ((this.OnSniff != null) || (this.OnSniffPacket != null)) WebServer.OnSession += new MiniWebServer.NewSessionHandler(SniffSessionSink);
Expand All @@ -774,6 +772,12 @@ private void NewDeviceInterface(NetworkInfo sender, IPAddress ip)
WebServer.OnHeader += new MiniWebServer.HTTPReceiveHandler(HandleHeaderRequest);
WebServerTable[ip.ToString()] = WebServer;
SendNotify(ip);

// Use the same port for all network interfaces
if (UseThisPort == 0)
{
UseThisPort = WebServer.LocalIPEndPoint.Port;
}
}
catch (SocketException ex)
{
Expand Down

0 comments on commit 0188e60

Please sign in to comment.