diff options
Diffstat (limited to 'MediaBrowser.Model/Net')
| -rw-r--r-- | MediaBrowser.Model/Net/IAcceptSocket.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/ISocket.cs | 15 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/ISocketFactory.cs | 4 |
3 files changed, 14 insertions, 10 deletions
diff --git a/MediaBrowser.Model/Net/IAcceptSocket.cs b/MediaBrowser.Model/Net/IAcceptSocket.cs index 4262e23901..2b5d33dce6 100644 --- a/MediaBrowser.Model/Net/IAcceptSocket.cs +++ b/MediaBrowser.Model/Net/IAcceptSocket.cs @@ -1,6 +1,4 @@ using System; -using System.Threading; -using System.Threading.Tasks; namespace MediaBrowser.Model.Net { @@ -15,7 +13,8 @@ namespace MediaBrowser.Model.Net void Bind(IpEndPointInfo endpoint); void Connect(IpEndPointInfo endPoint); void StartAccept(Action<IAcceptSocket> onAccept, Func<bool> isClosed); - Task SendFile(string path, byte[] preBuffer, byte[] postBuffer, CancellationToken cancellationToken); + IAsyncResult BeginSendFile(string path, byte[] preBuffer, byte[] postBuffer, AsyncCallback callback, object state); + void EndSendFile(IAsyncResult result); } public class SocketCreateException : Exception diff --git a/MediaBrowser.Model/Net/ISocket.cs b/MediaBrowser.Model/Net/ISocket.cs index 61fc0e28bf..7ad08f106e 100644 --- a/MediaBrowser.Model/Net/ISocket.cs +++ b/MediaBrowser.Model/Net/ISocket.cs @@ -14,16 +14,17 @@ namespace MediaBrowser.Model.Net { IpAddressInfo LocalIPAddress { get; } - /// <summary> - /// Waits for and returns the next UDP message sent to this socket (uni or multicast). - /// </summary> - /// <returns></returns> - Task<SocketReceiveResult> ReceiveAsync(CancellationToken cancellationToken); + Task<SocketReceiveResult> ReceiveAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken); + + IAsyncResult BeginReceive(byte[] buffer, int offset, int count, AsyncCallback callback); + SocketReceiveResult EndReceive(IAsyncResult result); /// <summary> /// Sends a UDP message to a particular end point (uni or multicast). /// </summary> - Task SendAsync(byte[] buffer, int bytes, IpEndPointInfo endPoint, CancellationToken cancellationToken); - Task SendWithLockAsync(byte[] buffer, int bytes, IpEndPointInfo endPoint, CancellationToken cancellationToken); + Task SendToAsync(byte[] buffer, int offset, int bytes, IpEndPointInfo endPoint, CancellationToken cancellationToken); + + IAsyncResult BeginSendTo(byte[] buffer, int offset, int size, IpEndPointInfo endPoint, AsyncCallback callback, object state); + int EndSendTo(IAsyncResult result); } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Net/ISocketFactory.cs b/MediaBrowser.Model/Net/ISocketFactory.cs index e7dbf6cb1e..bf2424660b 100644 --- a/MediaBrowser.Model/Net/ISocketFactory.cs +++ b/MediaBrowser.Model/Net/ISocketFactory.cs @@ -1,4 +1,6 @@ +using System.IO; + namespace MediaBrowser.Model.Net { /// <summary> @@ -33,6 +35,8 @@ namespace MediaBrowser.Model.Net ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort); IAcceptSocket CreateSocket(IpAddressFamily family, SocketType socketType, ProtocolType protocolType, bool dualMode); + + Stream CreateNetworkStream(ISocket socket, bool ownsSocket); } public enum SocketType |
