aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-03-26 19:36:52 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-03-26 19:36:52 -0400
commit5477bb95d9bf994f9c68bf5384d26db41c82d5de (patch)
tree1eb0b8eb0da482de7b3e53ca09645ba8b1f71ecb
parent85f4f8dbc970730eba083dec1d8b586510d965a0 (diff)
update socket methods
-rw-r--r--Emby.Common.Implementations/Net/UdpSocket.cs17
1 files changed, 11 insertions, 6 deletions
diff --git a/Emby.Common.Implementations/Net/UdpSocket.cs b/Emby.Common.Implementations/Net/UdpSocket.cs
index 834f0a05c..fc23422d7 100644
--- a/Emby.Common.Implementations/Net/UdpSocket.cs
+++ b/Emby.Common.Implementations/Net/UdpSocket.cs
@@ -49,7 +49,7 @@ namespace Emby.Common.Implementations.Net
private void InitReceiveSocketAsyncEventArgs()
{
- var receiveBuffer = new byte[8192];
+ var receiveBuffer = new byte[81920];
_receiveSocketAsyncEventArgs.SetBuffer(receiveBuffer, 0, receiveBuffer.Length);
_receiveSocketAsyncEventArgs.Completed += _receiveSocketAsyncEventArgs_Completed;
@@ -128,11 +128,18 @@ namespace Emby.Common.Implementations.Net
_receiveSocketAsyncEventArgs.RemoteEndPoint = receivedFromEndPoint;
_currentReceiveTaskCompletionSource = tcs;
- var willRaiseEvent = _Socket.ReceiveFromAsync(_receiveSocketAsyncEventArgs);
+ try
+ {
+ var willRaiseEvent = _Socket.ReceiveFromAsync(_receiveSocketAsyncEventArgs);
- if (!willRaiseEvent)
+ if (!willRaiseEvent)
+ {
+ _receiveSocketAsyncEventArgs_Completed(this, _receiveSocketAsyncEventArgs);
+ }
+ }
+ catch (Exception ex)
{
- _receiveSocketAsyncEventArgs_Completed(this, _receiveSocketAsyncEventArgs);
+ tcs.TrySetException(ex);
}
return tcs.Task;
@@ -189,8 +196,6 @@ namespace Emby.Common.Implementations.Net
taskSource.TrySetException(ex);
}
- //_Socket.SendTo(messageData, new System.Net.IPEndPoint(IPAddress.Parse(RemoteEndPoint.IPAddress), RemoteEndPoint.Port));
-
return taskSource.Task;
#endif
//ThrowIfDisposed();