connectie met server
This commit is contained in:
@@ -6,7 +6,7 @@ using ProftaakRH;
|
||||
|
||||
namespace Client
|
||||
{
|
||||
class Client : IDataReceiver
|
||||
public class Client : IDataReceiver
|
||||
{
|
||||
private TcpClient client;
|
||||
private NetworkStream stream;
|
||||
@@ -55,7 +55,7 @@ namespace Client
|
||||
|
||||
this.stream = this.client.GetStream();
|
||||
|
||||
tryLogin();
|
||||
tryLoginDoctor("hi","hi");
|
||||
|
||||
this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null);
|
||||
}
|
||||
@@ -203,6 +203,17 @@ namespace Client
|
||||
this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
|
||||
}
|
||||
|
||||
public void tryLoginDoctor(string username, string password)
|
||||
{
|
||||
string hashUser = Hashing.Hasher.HashString(username);
|
||||
string hashPassword = Hashing.Hasher.HashString(password);
|
||||
|
||||
byte[] message = DataParser.getJsonMessage(DataParser.GetLoginJson(hashUser, hashPassword));
|
||||
|
||||
|
||||
stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
|
||||
}
|
||||
|
||||
public void setHandler(IHandler handler)
|
||||
{
|
||||
this.handler = handler;
|
||||
|
||||
Reference in New Issue
Block a user