Fixes not getting \n on starting packet which would then have client send it on next packet, which then was wrong size.

This commit is contained in:
hondacrx
2020-08-20 23:28:23 -04:00
parent 165ae9e4f0
commit e049db795f
6 changed files with 281 additions and 192 deletions
+3 -5
View File
@@ -19,6 +19,7 @@ using System;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
@@ -66,10 +67,7 @@ namespace Framework.Networking
try
{
var result = await _stream.ReadAsync(_receiveBuffer, 0, _receiveBuffer.Length);
byte[] data = new byte[result];
Buffer.BlockCopy(_receiveBuffer, 0, data, 0, result);
ReadHandler(data, result);
ReadHandler(_receiveBuffer, result);
}
catch (Exception ex)
{
@@ -81,7 +79,7 @@ namespace Framework.Networking
{
try
{
await _stream.AuthenticateAsServerAsync(certificate, false, System.Security.Authentication.SslProtocols.Tls, false);
await _stream.AuthenticateAsServerAsync(certificate, false, SslProtocols.Tls, false);
}
catch(Exception ex)
{