Erlang.NET.OtpNode.ping C# (CSharp) 메소드

ping() 공개 메소드

public ping ( String node, long timeout ) : bool
node String
timeout long
리턴 bool
        public bool ping(String node, long timeout)
        {
            if (node.Equals(this.Node))
            {
                return true;
            }
            else if (node.IndexOf('@', 0) < 0 && node.Equals(this.Node.Substring(0, this.Node.IndexOf('@', 0))))
            {
                return true;
            }

            // other node
            OtpMbox mbox = null;
            try
            {
                mbox = createMbox(true);
                mbox.send("net_kernel", node, getPingTuple(mbox));
                OtpErlangObject reply = mbox.receive(timeout);
                OtpErlangTuple t = (OtpErlangTuple)reply;
                OtpErlangAtom a = (OtpErlangAtom)t.elementAt(1);
                return "yes".Equals(a.atomValue());
            }
            catch (Exception)
            {
            }
            finally
            {
                closeMbox(mbox);
            }
            return false;
        }

Usage Example

예제 #1
0
파일: ping.cs 프로젝트: takayuki/Erlang.NET
 public static void Main(string[] args)
 {
     OtpNode pingNode = new OtpNode("ping");
     OtpNode pongNode = new OtpNode("pong");
     bool ok = pingNode.ping("pong", 10000);
     pingNode.close();
     pongNode.close();
     Environment.Exit(ok ? 0 : 1);
 }
All Usage Examples Of Erlang.NET.OtpNode::ping