Ejemplo n.º 1
0
        public void TestMethod1()
        {
            var buffer = new byte[1000];

            var sendFrame = new DataFrame("abc");
            int sendFrameSize;
            sendFrame.WriteTo(buffer, out sendFrameSize);

            DataFrame receiveFrame;
            int receiveFrameSize;
            DataFrame.TryReadFrom(buffer, sendFrameSize, out receiveFrame, out receiveFrameSize);

            Assert.AreEqual(receiveFrameSize, sendFrameSize);
            Assert.AreEqual(receiveFrame.Message, sendFrame.Message);
        }
Ejemplo n.º 2
0
 private void WriteSendBuffer(string message)
 {
     var dataFrame = new DataFrame(message);
     int frameSize;
     dataFrame.WriteTo(outputBuffer, out frameSize);
     sendBufferOffset = 0;
     sendBufferSize = frameSize;
 }