UDP bot Please hlep

Created at 08 Mar 2015, 13:47
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!
NI

ninosgr

Joined 04.02.2014

UDP bot Please hlep
08 Mar 2015, 13:47


Hi could someone please help me with the following code?

I get the following error:

Crashed in OnStart with SecurityException: Request for the permission of type 'System.Net.DnsPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

THE CODE IS:

using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mountos1 : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            Print("mountosprint");
            MainClass.Main();
            Print("mountosprint");
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }

}
class MainClass
{
    public static void Main()
    {

        byte[] data = new byte[1024];
        string stringData;
        UdpClient server = new UdpClient("127.0.0.1", 9050);

        IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);

        int test1 = 45;


        byte[] data1 = BitConverter.GetBytes(test1);
        server.Send(data1, data1.Length);


        server.Close();
    }
}
 

 

 


@ninosgr
Replies

mindbreaker
08 Mar 2015, 15:43

Hello,

change this ) /api/reference/accessrights (

AccessRights = AccessRights.None

AccessRights.Internet

or

AccessRights.FullAccess

probably.

 


@mindbreaker