Otp.AbstractConnection.recvStatus C# (CSharp) Method

recvStatus() protected method

protected recvStatus ( ) : void
return void
        protected internal virtual void  recvStatus()
        {

            try
            {
                byte[] buf = read2BytePackage();
                OtpInputStream ibuf = new OtpInputStream(buf);
                int tag = ibuf.read1();
                if (tag != ChallengeStatus)
                {
                    throw new System.IO.IOException("Handshake protocol error");
                }
                byte[] tmpbuf = new byte[buf.Length - 1];
                ibuf.readN(tmpbuf);
                char[] tmpChar;
                tmpChar = new char[tmpbuf.Length];
                tmpbuf.CopyTo(tmpChar, 0);
                System.String status = new System.String(tmpChar);

                if (status.CompareTo("ok") != 0)
                {
                    throw new System.IO.IOException("Peer replied with status '" + status + "' instead of 'ok'");
                }
            }
            catch (Erlang.Exception)
            {
                throw new System.IO.IOException("Handshake failed - not enough data");
            }
            catch (System.Net.Sockets.SocketException e)
            {
                throw new System.IO.IOException("Peer dropped connection: " + e.ToString());
            }

            if (traceLevel >= OtpTrace.Type.handshakeThreshold)
            {
                OtpTrace.TraceEvent("<- " + "HANDSHAKE recvStatus (ok)" + " local=" + self);
            }
        }