mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-02-17 00:16:20 +01:00
More changes to UDP
This commit is contained in:
parent
773a7a0423
commit
c02230265c
@ -85,7 +85,6 @@ namespace DS4Windows
|
|||||||
for (int num = 0; num <= 19; num++)
|
for (int num = 0; num <= 19; num++)
|
||||||
{
|
{
|
||||||
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
|
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
|
||||||
args.Completed += CompletedBuffer;
|
|
||||||
args.SetBuffer(new byte[100], 0, 100);
|
args.SetBuffer(new byte[100], 0, 100);
|
||||||
argsList[num] = args;
|
argsList[num] = args;
|
||||||
}
|
}
|
||||||
@ -189,7 +188,7 @@ namespace DS4Windows
|
|||||||
int temp = 0;
|
int temp = 0;
|
||||||
poolLock.EnterWriteLock();
|
poolLock.EnterWriteLock();
|
||||||
temp = listInd;
|
temp = listInd;
|
||||||
listInd = (listInd + 1) % 20;
|
listInd = ++listInd % 20;
|
||||||
SocketAsyncEventArgs args = argsList[temp];
|
SocketAsyncEventArgs args = argsList[temp];
|
||||||
poolLock.ExitWriteLock();
|
poolLock.ExitWriteLock();
|
||||||
|
|
||||||
@ -198,7 +197,6 @@ namespace DS4Windows
|
|||||||
//args.SetBuffer(packetData, 0, packetData.Length);
|
//args.SetBuffer(packetData, 0, packetData.Length);
|
||||||
try {
|
try {
|
||||||
udpSock.SendToAsync(args);
|
udpSock.SendToAsync(args);
|
||||||
//udpSock.BeginSendTo(packetData, 0, packetData.Length, SocketFlags.Broadcast, clientEP, null, null);
|
|
||||||
}
|
}
|
||||||
catch (Exception e) { }
|
catch (Exception e) { }
|
||||||
}
|
}
|
||||||
@ -656,16 +654,14 @@ namespace DS4Windows
|
|||||||
int temp = 0;
|
int temp = 0;
|
||||||
poolLock.EnterWriteLock();
|
poolLock.EnterWriteLock();
|
||||||
temp = listInd;
|
temp = listInd;
|
||||||
listInd = (listInd + 1) % 20;
|
listInd = ++listInd % 20;
|
||||||
SocketAsyncEventArgs args = argsList[temp];
|
SocketAsyncEventArgs args = argsList[temp];
|
||||||
poolLock.ExitWriteLock();
|
poolLock.ExitWriteLock();
|
||||||
|
|
||||||
args.RemoteEndPoint = cl;
|
args.RemoteEndPoint = cl;
|
||||||
//args.SetBuffer(outputData, 0, outputData.Length);
|
|
||||||
Array.Copy(outputData, args.Buffer, outputData.Length);
|
Array.Copy(outputData, args.Buffer, outputData.Length);
|
||||||
try {
|
try {
|
||||||
udpSock.SendToAsync(args);
|
udpSock.SendToAsync(args);
|
||||||
//udpSock.BeginSendTo(outputData, 0, outputData.Length, SocketFlags.Broadcast, cl, null, null);
|
|
||||||
}
|
}
|
||||||
catch (SocketException ex) { }
|
catch (SocketException ex) { }
|
||||||
}
|
}
|
||||||
@ -674,11 +670,5 @@ namespace DS4Windows
|
|||||||
clientsList.Clear();
|
clientsList.Clear();
|
||||||
clientsList = null;
|
clientsList = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CompletedBuffer(object sender, SocketAsyncEventArgs args)
|
|
||||||
{
|
|
||||||
//args.SetBuffer(null, 0, 0);
|
|
||||||
//args.RemoteEndPoint = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user