2
0

IAcceptSocket.cs 978 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. namespace MediaBrowser.Model.Net
  3. {
  4. public interface IAcceptSocket : IDisposable
  5. {
  6. bool DualMode { get; }
  7. IpEndPointInfo LocalEndPoint { get; }
  8. IpEndPointInfo RemoteEndPoint { get; }
  9. void Close();
  10. void Shutdown(bool both);
  11. void Listen(int backlog);
  12. void Bind(IpEndPointInfo endpoint);
  13. void Connect(IpEndPointInfo endPoint);
  14. void StartAccept(Action<IAcceptSocket> onAccept, Func<bool> isClosed);
  15. IAsyncResult BeginSendFile(string path, byte[] preBuffer, byte[] postBuffer, AsyncCallback callback, object state);
  16. void EndSendFile(IAsyncResult result);
  17. }
  18. public class SocketCreateException : Exception
  19. {
  20. public SocketCreateException(string errorCode, Exception originalException)
  21. : base(errorCode, originalException)
  22. {
  23. ErrorCode = errorCode;
  24. }
  25. public string ErrorCode { get; private set; }
  26. }
  27. }