edited clients
This commit is contained in:
@@ -19,9 +19,10 @@ namespace Client
|
|||||||
|
|
||||||
|
|
||||||
Client client = new Client();
|
Client client = new Client();
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Client() : this("localhost", 5555)
|
public Client() : this("localhost", 5555)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ namespace Server
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int receivedBytes = stream.EndRead(ar);
|
int receivedBytes = stream.EndRead(ar);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
@@ -46,7 +45,7 @@ namespace Server
|
|||||||
{
|
{
|
||||||
byte[] lenghtBytes = new byte[4];
|
byte[] lenghtBytes = new byte[4];
|
||||||
Array.Copy(buffer, counter, lenghtBytes, 0, 4);
|
Array.Copy(buffer, counter, lenghtBytes, 0, 4);
|
||||||
int length = Convert.ToInt32(lenghtBytes);
|
int length = BitConverter.ToInt32(lenghtBytes);
|
||||||
byte[] packet = new byte[length];
|
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));
|
HandleData(Encoding.Default.GetString(packet));
|
||||||
|
|||||||
Reference in New Issue
Block a user