2017-03-02 20:50:09 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Model.Net
|
|
|
|
|
{
|
|
|
|
|
public interface IAcceptSocket : IDisposable
|
|
|
|
|
{
|
|
|
|
|
bool DualMode { get; }
|
|
|
|
|
IpEndPointInfo LocalEndPoint { get; }
|
|
|
|
|
IpEndPointInfo RemoteEndPoint { get; }
|
|
|
|
|
void Close();
|
|
|
|
|
void Shutdown(bool both);
|
|
|
|
|
void Listen(int backlog);
|
|
|
|
|
void Bind(IpEndPointInfo endpoint);
|
2017-03-03 05:53:21 +00:00
|
|
|
|
void Connect(IpEndPointInfo endPoint);
|
2017-03-02 20:50:09 +00:00
|
|
|
|
void StartAccept(Action<IAcceptSocket> onAccept, Func<bool> isClosed);
|
2017-05-26 06:48:54 +00:00
|
|
|
|
IAsyncResult BeginSendFile(string path, byte[] preBuffer, byte[] postBuffer, AsyncCallback callback, object state);
|
|
|
|
|
void EndSendFile(IAsyncResult result);
|
2017-03-02 20:50:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class SocketCreateException : Exception
|
|
|
|
|
{
|
|
|
|
|
public SocketCreateException(string errorCode, Exception originalException)
|
|
|
|
|
: base(errorCode, originalException)
|
|
|
|
|
{
|
|
|
|
|
ErrorCode = errorCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string ErrorCode { get; private set; }
|
|
|
|
|
}
|
|
|
|
|
}
|