Get MAC IP for use in indicator

Created at 03 Dec 2020, 16:48
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
M.

m.ghobeishavi1986

Joined 14.06.2018

Get MAC IP for use in indicator
03 Dec 2020, 16:48


I input these code:

public string GetMACAddress()
        {
            NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
            string sMacAddress = "";
            try
            {
                foreach (NetworkInterface adapter in nics)
                {
                    // only return MAC Address from first card  
                    if (sMacAddress == String.Empty)
                    {
                        IPInterfaceProperties properties = adapter.GetIPProperties();
                        sMacAddress = adapter.GetPhysicalAddress().ToString();
                    }
                }
            } catch
            {
                sMacAddress = "";
            }
            return sMacAddress;
        }

How can I solve these Errors.

Thank you.


cTrader
@m.ghobeishavi1986