UaClient.Controls.SelectEndpointCtrl

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
xiaoqing
Jr. Member
Jr. Member
Posts: 2
Joined: 26 Feb 2013, 17:03

UaClient.Controls.SelectEndpointCtrl

Post by xiaoqing »

I am learning how to use use "UnifiedAutomation.UaClient.Controls.SelectEndpointCtrl" and I am using the free downloaded versions.

When I click the "+" button, my "Find Servers" dialog always shows exception "No connection could be made because the target machine actively refused it 127.0.0.1:4840".

It looks to me that port number "4840" is default in the UnifiedAutomation.UaClient.Controls.

I have to change my server port number from "48030" to "4840" to make it work.

My question is how to configure the port number when I use UaClient.Controls in my client application?

xiaoqing
Jr. Member
Jr. Member
Posts: 2
Joined: 26 Feb 2013, 17:03

Re: UaClient.Controls.SelectEndpointCtrl

Post by xiaoqing »

I think there is a bug in the "DiscoverBTN_Click" function on SelectEndpointCtrl.

private void DiscoverBTN_Click(object sender, EventArgs e)
{
try
{
this.ServersLV.Items.Clear();
string text = this.MachineNameCB.Text;
if (this.MachineNameCB.SelectedIndex >= 0)
{
text = (string) this.MachineNameCB.SelectedItem;
}
string uriString = "opc.tcp://" + text + ":4840"; //--->BUG: Hard CODE the port number here
if (!Uri.IsWellFormedUriString(uriString, UriKind.Absolute))
{
throw new ArgumentException("The machine name is not a valid DNS name or IP address.", "machineName");
}
if (this.MachineNameCB.SelectedIndex < 0)
{
this.MachineNameCB.SelectedIndex = this.MachineNameCB.Items.Add(text);
}
RequestSettings settings = new RequestSettings {
OperationTimeout = 0x1388
};
//BUG: Use the hard coded uriString here
this.m_discovery.BeginFindServers(uriString, this.m_locales, null, settings, new AsyncCallback(this.OnDiscoverComplete), null);
}
catch (Exception exception)
{
ExceptionDlg.Show(this.Text, exception);
}
}

Post Reply