Skip to content

Commit

Permalink
Added: IPv6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
margro committed Jul 22, 2016
1 parent 07529de commit 031c291
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions TVServerKodi/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.15.0.135:
- Added: IPv6 support

1.15.0.134:
- Updated: referenced assemblies for TVServer 1.15.0 (final)
- Fixed: GetDriveSpace function for network shares and large disks (credits: Timothy Massing)
Expand Down
24 changes: 20 additions & 4 deletions TVServerKodi/Listener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,38 @@ class Listener
public Listener()
{
this.port = 9596;
this.tcpListener = new TcpListener(IPAddress.Any, port);
CreateTCPListener();
}

public Listener(int listenport)
private void CreateTCPListener()
{
this.port = listenport;
try
{
this.tcpListener = new TcpListener(IPAddress.Any, port);
if (System.Environment.OSVersion.Version.Major < 6)
{
// ipv4 only (older than Vista):
this.tcpListener = new TcpListener(IPAddress.Any, port);

}
else
{
// Dual stack: accept ipv6 and ipv4 connections
this.tcpListener = new TcpListener(IPAddress.IPv6Any, port);
tcpListener.Server.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, false);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}

public Listener(int listenport)
{
this.port = listenport;
CreateTCPListener();
}


public bool StartListening()
{
Expand Down
4 changes: 2 additions & 2 deletions TVServerKodi/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.15.0.134")]
[assembly: AssemblyFileVersion("1.15.0.134")]
[assembly: AssemblyVersion("1.15.0.135")]
[assembly: AssemblyFileVersion("1.15.0.135")]

// Set usage and compatibility information to MediaPortal v1.3.0 beta and above
[assembly: CompatibleVersion("1.9.100.0", "1.5.0.0")]
Expand Down

0 comments on commit 031c291

Please sign in to comment.