public void StartClient() { client = null; string dispServerHost = Properties.Settings.Default.QueueServerHost; int dispServerPort = Properties.Settings.Default.QueueServerPort; string stationName = Properties.Settings.Default.StationName; string stationPost = Properties.Settings.Default.StationPost; string userName = Properties.Settings.Default.QueueUserName; string password = Properties.Settings.Default.QueuePassword; client = new TCPClient(dispServerHost, dispServerPort); client.Notified += new Action <NotifyEventArgs>(TCPClient_Notified); client.Start(); if (client.Connected) { client.Session.DataReceived += new DataReceived(NetSession_DataReceived); string salt = Properties.Settings.Default.SecuritySalt; string clearPwd = Util.DecryptPassword(password, salt); string passwordHash = Util.GetPasswordHash(clearPwd, userName); /// Send LOGIN message + our station name to server string message = String.Empty; message = "LOGIN" + Msg.Separator + "CALLER" + Msg.Separator + stationName + Msg.Separator + stationPost + Msg.Separator + userName + Msg.Separator + passwordHash; client.Send(message); } }
public void StartClient() { _client = null; _client = new TCPClient(_settings.QueueServerHost, _settings.QueueServerPort); _client.Notified += new Action <NotifyEventArgs>(TCPClientNotified); _client.Start(); if (_client.Connected) { _client.Session.DataReceived += new DataReceived(NetSessionDataReceived); string clearPwd = Util.DecryptPassword(_settings.QueuePassword, _settings.SecuritySalt); string passwordHash = Util.GetPasswordHash(clearPwd, _settings.QueueUserName); // SYS|LOGIN|REQ|[Module!Post!Station!Username!Password] string message = Msg.SysLogin.Text + Msg.Separator + "REQ" + Msg.Separator + "CALLER" + Msg.CompDelimiter + _settings.StationPost + Msg.CompDelimiter + _settings.StationName + Msg.CompDelimiter + _settings.QueueUserName + Msg.CompDelimiter + passwordHash; _client.Send(message); } }