Update Program.cs
This commit is contained in:
parent
94a33646a8
commit
df79845f74
@ -46,6 +46,7 @@ namespace Client
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Disconnected!");
|
||||
Thread.Sleep(2500);
|
||||
InitializeClient();
|
||||
}
|
||||
@ -63,7 +64,12 @@ namespace Client
|
||||
|
||||
public static void ReadServertData(IAsyncResult ar)
|
||||
{
|
||||
|
||||
if (client.Connected == false)
|
||||
{
|
||||
client.Close();
|
||||
client.Dispose();
|
||||
InitializeClient();
|
||||
}
|
||||
try
|
||||
{
|
||||
int Recevied = client.EndReceive(ar);
|
||||
@ -102,6 +108,12 @@ namespace Client
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
client.Close();
|
||||
client.Dispose();
|
||||
InitializeClient();
|
||||
}
|
||||
client.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, ReadServertData, null);
|
||||
}
|
||||
catch
|
||||
@ -129,10 +141,11 @@ namespace Client
|
||||
}
|
||||
|
||||
public static void BeginSend(byte[] Msgs)
|
||||
{
|
||||
if (client.Connected)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
using (MemoryStream MS = new MemoryStream())
|
||||
{
|
||||
byte[] buffer = Msgs;
|
||||
@ -145,7 +158,7 @@ namespace Client
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,8 +169,7 @@ namespace Client
|
||||
client.EndSend(ar);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
{ }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user