mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 09:04:42 +01:00
update portable projects
This commit is contained in:
16
MediaBrowser.Model/Net/ISocket.cs
Normal file
16
MediaBrowser.Model/Net/ISocket.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
public interface ISocket : IDisposable
|
||||
{
|
||||
IpEndPointInfo LocalEndPoint { get; }
|
||||
IpEndPointInfo RemoteEndPoint { get; }
|
||||
void Close();
|
||||
void Shutdown(bool both);
|
||||
void Listen(int backlog);
|
||||
void Bind(IpEndPointInfo endpoint);
|
||||
|
||||
void StartAccept(Action<ISocket> onAccept, Func<bool> isClosed);
|
||||
}
|
||||
}
|
||||
@@ -27,5 +27,17 @@ namespace MediaBrowser.Model.Net
|
||||
/// <param name="localPort">The local port to bind to.</param>
|
||||
/// <returns>A <see cref="IUdpSocket"/> implementation.</returns>
|
||||
IUdpSocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort);
|
||||
}
|
||||
|
||||
ISocket CreateSocket(IpAddressFamily family, SocketType socketType, ProtocolType protocolType, bool dualMode);
|
||||
}
|
||||
|
||||
public enum SocketType
|
||||
{
|
||||
Stream
|
||||
}
|
||||
|
||||
public enum ProtocolType
|
||||
{
|
||||
Tcp
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,39 @@ namespace MediaBrowser.Model.Net
|
||||
{
|
||||
public class IpAddressInfo
|
||||
{
|
||||
public static IpAddressInfo Any = new IpAddressInfo("0.0.0.0", IpAddressFamily.InterNetwork);
|
||||
public static IpAddressInfo IPv6Any = new IpAddressInfo("00000000000000000000", IpAddressFamily.InterNetworkV6);
|
||||
public static IpAddressInfo Loopback = new IpAddressInfo("127.0.0.1", IpAddressFamily.InterNetwork);
|
||||
public static IpAddressInfo IPv6Loopback = new IpAddressInfo("IPv6Loopback", IpAddressFamily.InterNetworkV6);
|
||||
|
||||
public string Address { get; set; }
|
||||
public bool IsIpv6 { get; set; }
|
||||
public IpAddressFamily AddressFamily { get; set; }
|
||||
|
||||
public IpAddressInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IpAddressInfo(string address, IpAddressFamily addressFamily)
|
||||
{
|
||||
Address = address;
|
||||
AddressFamily = addressFamily;
|
||||
}
|
||||
|
||||
public bool Equals(IpAddressInfo address)
|
||||
{
|
||||
return string.Equals(address.Address, Address, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public override String ToString()
|
||||
{
|
||||
return Address;
|
||||
}
|
||||
}
|
||||
|
||||
public enum IpAddressFamily
|
||||
{
|
||||
InterNetwork,
|
||||
InterNetworkV6
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
@@ -8,11 +9,22 @@ namespace MediaBrowser.Model.Net
|
||||
|
||||
public int Port { get; set; }
|
||||
|
||||
public IpEndPointInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IpEndPointInfo(IpAddressInfo address, int port)
|
||||
{
|
||||
IpAddress = address;
|
||||
Port = port;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var ipAddresString = IpAddress == null ? string.Empty : IpAddress.ToString();
|
||||
|
||||
return ipAddresString + ":" + this.Port.ToString();
|
||||
return ipAddresString + ":" + Port.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user