Example #1
0
        private void sendBuf(ErlTuple ctrl, ErlOutputStream payload = null)
        {
            if (!m_Connected)
            {
                throw new ErlException(StringConsts.ERL_CONN_NOT_CONNECTED_ERROR);
            }

            var header = new ErlOutputStream(writeVersion: false, capacity: HEADER_LEN);

            // preamble: 4 byte length + "PASS_THROUGH" tag + version
            header.Write4BE(0); // reserve space for length
            header.Write1(PASS_THROUGH);
            header.Write1((byte)ErlExternalTag.Version);

            // header info
            header.WriteTuple(ctrl);

            // version for payload
            //header.Write1((byte)ErlExternalTag.Version); // Note that it's already written in the payload

            if (payload == null)
            {
                header.Poke4BE(0, (int)(header.Length - 4));
                DoSend(header);
            }
            else
            {
                header.Poke4BE(0, (int)(header.Length + payload.Length - 4));
                DoSend(header, payload);
            }
        }
Example #2
0
        private void sendBuf(ErlTuple ctrl, ErlOutputStream payload = null)
        {
            if (!m_Connected)
            throw new ErlException(StringConsts.ERL_CONN_NOT_CONNECTED_ERROR);

              var header = new ErlOutputStream(writeVersion: false, capacity: HEADER_LEN);

              // preamble: 4 byte length + "PASS_THROUGH" tag + version
              header.Write4BE(0); // reserve space for length
              header.Write1(PASS_THROUGH);
              header.Write1((byte)ErlExternalTag.Version);

              // header info
              header.WriteTuple(ctrl);

              // version for payload
              //header.Write1((byte)ErlExternalTag.Version); // Note that it's already written in the payload

              if (payload == null)
              {
            header.Poke4BE(0, (int)(header.Length - 4));
            DoSend(header);
              }
              else
              {
            header.Poke4BE(0, (int)(header.Length + payload.Length - 4));
            DoSend(header, payload);
              }
        }