aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Net/IAcceptSocket.cs
blob: 2b5d33dce66eb47c0f5b282ea4f10de5654fb662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);
        void Connect(IpEndPointInfo endPoint);
        void StartAccept(Action<IAcceptSocket> onAccept, Func<bool> isClosed);
        IAsyncResult BeginSendFile(string path, byte[] preBuffer, byte[] postBuffer, AsyncCallback callback, object state);
        void EndSendFile(IAsyncResult result);
    }

    public class SocketCreateException : Exception
    {
        public SocketCreateException(string errorCode, Exception originalException)
            : base(errorCode, originalException)
        {
            ErrorCode = errorCode;
        }

        public string ErrorCode { get; private set; }
    }
}