update socket methods

pull/1154/head
Luke Pulverenti 8 years ago
parent 85f4f8dbc9
commit 5477bb95d9

@ -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();

Loading…
Cancel
Save