|
|
@@ -11,6 +11,7 @@ using System.Threading;
|
|
|
using System.Windows.Forms;
|
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
using System.Security.Authentication;
|
|
|
+using System.IO;
|
|
|
|
|
|
namespace FietsClient
|
|
|
{
|
|
|
@@ -118,18 +119,28 @@ namespace FietsClient
|
|
|
|
|
|
public void disconnect()
|
|
|
{
|
|
|
- receiveThread.Abort();
|
|
|
+
|
|
|
sslStream.Close();
|
|
|
client.Close();
|
|
|
+ receiveThread.Abort();
|
|
|
isConnectedFlag = false;
|
|
|
}
|
|
|
|
|
|
public void receive()
|
|
|
{
|
|
|
- while (true)
|
|
|
+ while (client.Connected)
|
|
|
{
|
|
|
byte[] bytesFrom = new byte[(int)client.ReceiveBufferSize];
|
|
|
- sslStream.Read(bytesFrom, 0, client.ReceiveBufferSize);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ sslStream.Read(bytesFrom, 0, client.ReceiveBufferSize);
|
|
|
+ }
|
|
|
+ catch (IOException e)
|
|
|
+ {
|
|
|
+ Console.WriteLine(e.StackTrace);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
string response = Encoding.ASCII.GetString(bytesFrom);
|
|
|
string[] response_parts = response.Split('|');
|
|
|
|