public void Send_Sasl_Msg(SaslStatus status, byte[] body) { _MessageHeader[0] = statusBytes[(int)status - 1]; EncodingUtils.encodeBigEndian(body.Length, _MessageHeader, STATUS_BYTES); _socket.Write(_MessageHeader); _socket.Write(body); _socket.Flush(); }
public Sasl_Msg Recv_Sasl_Msg() { Sasl_Msg result = new Sasl_Msg(); _socket.ReadAll(_MessageHeader, 0, _MessageHeader.Length); result.Status = (SaslStatus)(statusBytes.IndexOf(_MessageHeader[0]) + 1); byte[] body = new byte[EncodingUtils.decodeBigEndian(_MessageHeader, STATUS_BYTES)]; _socket.ReadAll(body, 0, body.Length); result.Body = Encoding.UTF8.GetString(body); return(result); }
public void WriteLength(int length) { byte[] lenBuf = new byte[4]; EncodingUtils.encodeFrameSize(length, lenBuf); _socket.Write(lenBuf); }
public int ReadLength() { byte[] lenBuf = new byte[4]; _socket.ReadAll(lenBuf, 0, lenBuf.Length); return(EncodingUtils.decodeBigEndian(lenBuf)); }