ISocket.cs 749 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. namespace MediaBrowser.Model.Net
  3. {
  4. public interface ISocket : 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 StartAccept(Action<ISocket> onAccept, Func<bool> isClosed);
  14. }
  15. public class SocketCreateException : Exception
  16. {
  17. public SocketCreateException(string errorCode, Exception originalException)
  18. : base(errorCode, originalException)
  19. {
  20. ErrorCode = errorCode;
  21. }
  22. public string ErrorCode { get; private set; }
  23. }
  24. }