Otp.AbstractConnection.sendName C# (CSharp) Method

sendName() protected method

protected sendName ( int dist, int flags ) : void
dist int
flags int
return void
        protected internal virtual void  sendName(int dist, int flags)
        {
            
            OtpOutputStream obuf = new OtpOutputStream();
            System.String str = self.node();
            obuf.write2BE(str.Length + 7); // 7 bytes + nodename
            obuf.write1(AbstractNode.NTYPE_R6);
            obuf.write2BE((short)dist);
            obuf.write4BE(flags);
            //UPGRADE_NOTE: This code will be optimized in the future;
            byte[] tmpBytes;
            int i;
            string tmpStr;
            tmpStr = str;
            tmpBytes = new byte[tmpStr.Length];
            i = 0;
            while (i < tmpStr.Length)
            {
                tmpBytes[i] = (byte) tmpStr[i];
                i++;
            }
            obuf.write(tmpBytes);
            
            obuf.writeTo((System.IO.Stream) socket.GetStream());
            
            if (traceLevel >= OtpTrace.Type.handshakeThreshold)
            {
                OtpTrace.TraceEvent("-> " + "HANDSHAKE sendName" + " flags=" + flags + " dist=" + dist + " local=" + self);
            }
        }