Beispiel #1
0
        private void ClientReceivedClassBCallback(ReceivedMessage receivedMessage)
        {
            // Unpack and display the data in the received class
            var message = receivedMessage.GetContent <ClassB>();

            Console.WriteLine($"Client: received message: {message.VarString}");
        }
Beispiel #2
0
        private void ServerReceivedClassACallback(ReceivedMessage receivedMessage)
        {
            // get data from received message
            var receivedObject = receivedMessage.GetContent <ClassA>();

            // Notify that the server received data
            Console.WriteLine($"Server received message: {receivedObject.VarDouble}, {receivedObject.VarInt}");
        }
Beispiel #3
0
        private void ServerReceivedClassACallback(ReceivedMessage receivedMessage)
        {
            // get data from received message
            var receivedObject = receivedMessage.GetContent <ClassA>();

            // Indicate that the server received data
            Console.WriteLine($"Server: received message {receivedObject.VarDouble}, {receivedObject.VarInt}");

            // Create a response object with string content, based on the received message
            var sendMessage = new ClassB()
            {
                VarString = $"{receivedObject.VarDouble}, {receivedObject.VarInt}"
            };

            // Reply to received message
            Console.WriteLine($"Server: replying to client {sendMessage.VarString}");
            _server.Reply(sendMessage, receivedMessage);
        }