2016-11-08 18:44:23 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Model.Net
|
|
|
|
|
{
|
|
|
|
|
public interface ISocket : IDisposable
|
|
|
|
|
{
|
2016-12-07 20:02:34 +00:00
|
|
|
|
bool DualMode { get; }
|
2016-11-08 18:44:23 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
2016-12-07 20:02:34 +00:00
|
|
|
|
|
|
|
|
|
public class SocketCreateException : Exception
|
|
|
|
|
{
|
|
|
|
|
public SocketCreateException(string errorCode, Exception originalException)
|
|
|
|
|
: base(errorCode, originalException)
|
|
|
|
|
{
|
|
|
|
|
ErrorCode = errorCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string ErrorCode { get; private set; }
|
|
|
|
|
}
|
2016-11-08 18:44:23 +00:00
|
|
|
|
}
|