From 35af8d3172cf4f608c9b80df1021f3e80b63624b Mon Sep 17 00:00:00 2001 From: Jason T Alborough Date: Mon, 24 Jun 2019 17:40:41 -0400 Subject: [PATCH] # PDC-17 FixSettingHostname&Port - I'm not sure this is the best way to fix this. I think the hostname and port variables need to be rethought in the TcpClient wrappers. This works for my needs for now but we still need to fix it globally. --- .../Comm/GenericTcpIpClient.cs | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs b/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs index 65c428f..b99dfaa 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs @@ -29,10 +29,27 @@ namespace PepperDash.Core //public event GenericSocketStatusChangeEventDelegate SocketStatusChange; public event EventHandler ConnectionChange; + + private string _Hostname { get; set;} /// /// Address of server /// - public string Hostname { get; set; } + public string Hostname { + get + { + return _Hostname; + } + + set + { + _Hostname = value; + if (Client != null) + { + + Client.AddressClientConnectedTo = _Hostname; + } + } + } /// /// Port on server @@ -233,10 +250,13 @@ namespace PepperDash.Core if (Client == null) { + + Client = new TCPClient(Hostname, Port, BufferSize); Client.SocketStatusChange += Client_SocketStatusChange; } DisconnectCalledByUser = false; + Client.ConnectToServerAsync(ConnectToServerCallback); // (null); }