예제 #1
0
        public ErlConnection Connection(string node, ErlAtom?cookie = null)
        {
            var nodeName = ErlAbstractNode.NodeShortName(node, UseShortName);

            return(Connection(nodeName, cookie));
        }
예제 #2
0
        private void sendName(int dist, ErlAbstractNode.NodeCompatibility flags)
        {
            string str = m_Home.NodeName.Value;
              var obuf = new ErlOutputStream(writeVersion: false, writePktSize: false, capacity: 7 + str.Length);
              obuf.Write2BE(str.Length + 7); // 7 bytes + nodename
              obuf.Write1((int)ErlAbstractNode.NodeType.Ntype_R6);
              obuf.Write2BE((short)dist);
              obuf.Write4BE((int)flags);
              obuf.Write(Encoding.ASCII.GetBytes(str));

              obuf.WriteTo(m_Transport.GetStream());

              m_Home.OnTrace(ErlTraceLevel.Handshake, Direction.Outbound, () =>
              "sendName(flags({0:X2})={1}, dist={2}, local={3}".Args(
              (int)flags, flags, dist, m_Home.AliveName));
        }
예제 #3
0
    private void sendChallenge(int dist, ErlAbstractNode.NodeCompatibility flags, int challenge)
    {
      ErlAtom str = m_Home.NodeName;
      var obuf = new ErlOutputStream(writeVersion: false, writePktSize: false, capacity: 11 + str.Length);
      obuf.Write2BE((short)str.Length + 11); // 11 bytes + nodename
      obuf.Write1((byte)ErlAbstractNode.NodeType.Ntype_R6);
      obuf.Write2BE((short)dist);
      obuf.Write4BE((int)flags);
      obuf.Write4BE(challenge);
      obuf.Write(Encoding.ASCII.GetBytes(str.Value));

      obuf.WriteTo(m_TcpClient.GetStream());

      m_Home.Trace(ErlTraceLevel.Handshake, Direction.Outbound, () =>
          "sendChallenge(flags({0:X2})={1}, dist={2}, challenge={3}, local={4}".Args(
              (int)flags, flags, dist, challenge, m_Home.AliveName));
    }