Beispiel #1
0
        public static void Main(string[] args)
        {
            OtpNode self = new OtpNode(new NodeDetails()
            {
                Node   = "vaplug",
                Cookie = "edsrv_cookie",
                Flags  = OtpInputStream.StreamFlags.DecodeIntListsAsStrings
            });
            OtpMbox        mbox  = self.CreateMbox("test");
            OtpErlangTuple tuple = new OtpErlangTuple(
                mbox.Self,
                new OtpErlangTuple(
                    new OtpErlangAtom("echo"),
                    new OtpErlangString(OtpErlangString.FromCodePoints(new int[] { 127744, 32, 69, 108, 32, 78, 105, 241, 111 })) // 🌀 El Niño
                    )
                );

            //send message to registered process hello_server on node one @grannysmith
            //> { hello_server, 'one@grannysmith'} ! test.

            mbox.Send("edsrv@GAMING", "player_srv", tuple);
            Logger.Debug("<- REPLY " + mbox.Receive());

            var reply = self.RPC("edsrv@GAMING", 1000, "edlib", "log_dir");

            Logger.Debug("<- LOG " + reply);
        }
Beispiel #2
0
            public override IEnumerator <Continuation> GetEnumerator()
            {
                OtpMbox mbox = base.Mbox;
                OtpMsg  msg  = null;

                while (true)
                {
                    yield return(delegate(OtpMsg m) { msg = m; });

                    log.Debug("-> ECHO " + msg.getMsg());
                    OtpErlangTuple    t      = (OtpErlangTuple)msg.getMsg();
                    OtpErlangPid      sender = (OtpErlangPid)t.elementAt(0);
                    OtpErlangObject[] v      = { mbox.Self, t.elementAt(1) };
                    mbox.send(sender, new OtpErlangTuple(v));
                }
            }
Beispiel #3
0
        public static void Main(string[] args)
        {
            OtpNode b    = new OtpNode("b");
            var     echo = b.CreateMbox("echo");

            echo.Received += (e) =>
            {
                OtpErlangTuple t      = (OtpErlangTuple)e.Msg.Payload;
                OtpErlangPid   sender = (OtpErlangPid)t.ElementAt(0);
                Logger.Debug($"-> ECHO {t.ElementAt(1)} from {sender}");
                t[0] = e.Mbox.Self;
                e.Mbox.Send(sender, t);
            };

            OtpNode a        = new OtpNode("a");
            OtpMbox echoback = a.CreateMbox("echoback");

            echoback.Send(echo.Self, new OtpErlangTuple(echoback.Self, new OtpErlangString("Hello, World!")));
            Logger.Debug($"<- ECHO (back) {echoback.ReceiveMsg()}");

            a.Close();
            b.Close();
        }
 /// <summary>Initializes a new instance of the <see cref="ErlangErrorRpcException"/> class.</summary>
 /// <param name="tuple">The tuple.</param>
 public ErlangErrorRpcException(OtpErlangTuple tuple) : base(tuple.ToString())
 {
     this.reasonTuple = tuple;
 }
Beispiel #5
0
        /// <summary>Extracts the name value from tuple.</summary>
        /// <param name="value">The value.</param>
        /// <returns>The name value.</returns>
        private string ExtractNameValueFromTuple(OtpErlangTuple value)
        {
            object nameElement = value.elementAt(3);

            return(new UTF8Encoding().GetString(((OtpErlangBinary)nameElement).binaryValue()));
        }