Exemplo n.º 1
0
        public void SendRequest(DsiCommand command, byte[] payload, AfpTransportReplyHandler replyHandler = null)
        {
            DsiHeader header = new DsiHeader()
            {
                command   = command,
                flags     = DsiFlags.Request,
                requestId = this.NextRequestId(),
                errorCodeOrWriteOffset = 0,
                totalDataLength        = (uint)payload.Length
            };

            AfpStream stream = new AfpStream();

            header.Write(stream);
            stream.WriteBytes(payload);

            if (replyHandler != null)
            {
                _replyHandlers[header.requestId] = replyHandler;
            }

            byte[] result = stream.ToByteArray();

            this.SendBuffer(result);
        }
Exemplo n.º 2
0
        public DsiHeader WriteReply(AfpResultCode resultCode, byte[] resultPayload, AfpStream writeToStream)
        {
            DsiHeader replyHeader = this.CreateReply(resultCode, (uint)resultPayload.Length);

            replyHeader.Write(writeToStream);
            writeToStream.WriteBytes(resultPayload);

            return(replyHeader);
        }
Exemplo n.º 3
0
        public void SendRequest(DsiCommand command, byte[] payload, AfpTransportReplyHandler replyHandler = null) {
            DsiHeader header = new DsiHeader() {
                command = command,
                flags = DsiFlags.Request,
                requestId = this.NextRequestId(),
                errorCodeOrWriteOffset = 0,
                totalDataLength = (uint)payload.Length
            };

            AfpStream stream = new AfpStream();
            header.Write(stream);
            stream.WriteBytes(payload);

            if (replyHandler != null) {
                _replyHandlers[header.requestId] = replyHandler;
            }

            byte[] result = stream.ToByteArray();

            this.SendBuffer(result);
        }