I must be missing something as I thought this should be simple. I'm creating a protocol that uses http request. In the QAction I'd like to retrieve the polling IP address (the one you specify when you create the element).
How can this be done?
Thanks!
Hi Trong Hunynh,
you can retrieve the polling IP address using the ElementInfoEventMessage class found in Skyline.DataMiner.Net.Messages.
/// <summary>
/// Gets Element Info Event Message Data.
/// </summary>
/// <param name="protocol">Link with SLProtocol Process.</param>
/// <returns>Element Info Event Object.</returns>
public static SLNetMessages.ElementInfoEventMessage GetElementInfo(SLProtocol protocol)
{
if (elementInfoResponse != null)
{
return elementInfoResponse;
}var getElementInfo = new SLNetMessages.GetElementByIDMessage(protocol.DataMinerID, protocol.ElementID);
elementInfoResponse = protocol.SLNet.SendSingleResponseMessage(getElementInfo) as SLNetMessages.ElementInfoEventMessage;
if (elementInfoResponse == null)
{
throw new InvalidOperationException("FAILED: Retrieving Element Info Event Message");
}return elementInfoResponse;
}
var elementInfo = GetElementInfo(protocol);
string pollingIP = elementInfo.MainPort.PollingIPAddress
It will look something like this.
Regards,