edited clients

This commit is contained in:
shinichi
2020-09-23 13:14:49 +02:00
parent e0e910ac25
commit e315e1cf3f
2 changed files with 5 additions and 5 deletions

View File

@@ -19,9 +19,10 @@ namespace Client
Client client = new Client();
while (true)
{
}
}
public Client() : this("localhost", 5555)
{

View File

@@ -32,7 +32,6 @@ namespace Server
try
{
int receivedBytes = stream.EndRead(ar);
}
catch (IOException)
{
@@ -46,9 +45,9 @@ namespace Server
{
byte[] lenghtBytes = new byte[4];
Array.Copy(buffer, counter, lenghtBytes, 0, 4);
int length = Convert.ToInt32(lenghtBytes);
int length = BitConverter.ToInt32(lenghtBytes);
byte[] packet = new byte[length];
Array.Copy(buffer, counter + 4, packet, 0, length-4);
Array.Copy(buffer, counter + 4, packet, 0, length - 4);
HandleData(Encoding.Default.GetString(packet));
counter += length;
}