write() public method

public write ( byte b ) : void
b byte
return void
コード例 #1
0
 protected internal virtual void  sendStatus(System.String status)
 {
     
     OtpOutputStream obuf = new OtpOutputStream();
     obuf.write2BE(status.Length + 1);
     obuf.write1(ChallengeStatus);
     //UPGRADE_NOTE: This code will be optimized in the future;
     byte[] tmpBytes;
     int i;
     string tmpStr;
     tmpStr = status;
     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 sendStatus" + " status=" + status + " local=" + self);
     }
 }
コード例 #2
0
 protected internal virtual void  sendChallenge(int dist, int flags, int challenge)
 {
     
     OtpOutputStream obuf = new OtpOutputStream();
     System.String str = self.node();
     obuf.write2BE(str.Length + 11); // 11 bytes + nodename
     obuf.write1(AbstractNode.NTYPE_R6);
     obuf.write2BE(dist);
     obuf.write4BE(flags);
     obuf.write4BE(challenge);
     //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 sendChallenge" + " flags=" + flags + " dist=" + dist + " challenge=" + challenge + " local=" + self);
     }
 }
コード例 #3
0
 protected internal virtual void  sendChallengeAck(byte[] digest)
 {
     
     OtpOutputStream obuf = new OtpOutputStream();
     obuf.write2BE(17);
     obuf.write1(ChallengeAck);
     obuf.write(digest);
     
     obuf.writeTo((System.IO.Stream) socket.GetStream());
     
     if (traceLevel >= OtpTrace.Type.handshakeThreshold)
     {
         OtpTrace.TraceEvent("-> " + "HANDSHAKE sendChallengeAck" + " digest=" + hex(digest) + " local=" + self);
     }
 }
コード例 #4
0
        protected internal virtual void sendChallengeReply(int challenge, byte[] digest)
        {
            OtpOutputStream obuf = new OtpOutputStream();
            obuf.write2BE(21);
            obuf.write1(ChallengeReply);
            obuf.write4BE(challenge);
            obuf.write(digest);
            obuf.writeTo((System.IO.Stream) socket.GetStream());

            if (traceLevel >= handshakeThreshold)
            {
                System.Console.Out.WriteLine("-> " + "HANDSHAKE sendChallengeReply" + " challenge=" + challenge + " digest=" + hex(digest) + " local=" + self);
            }
        }