예제 #1
0
파일: Server.cs 프로젝트: briandealwis/gt
        /// <summary>Handles a system message in that it takes the information and does something with it.</summary>
        /// <param name="message">The message received.</param>
        /// <param name="transport">The transport the message was received on.</param>
        protected override void HandleSystemMessage(SystemMessage message, ITransport transport)
        {
            switch (message.Descriptor)
            {
            case SystemMessageType.IdentityRequest:
                //they want to know their own id?  They should have received it already...
                // (see above in AddTransport())
                Send(new SystemIdentityResponseMessage(Identity),
                    new SpecificTransportRequirement(transport), null);
                break;

            default:
                base.HandleSystemMessage(message, transport);
                break;
            }
        }
예제 #2
0
        protected virtual void MarshalSystemMessage(SystemMessage msg, Stream output)
        {
            // SystemMessageType is the channelId
            switch (msg.Descriptor)
            {
            case SystemMessageType.PingRequest:
            case SystemMessageType.PingResponse:
                ByteUtils.Write(DataConverter.Converter.GetBytes(((SystemPingMessage)msg).SentTime), output);
                ByteUtils.Write(DataConverter.Converter.GetBytes(((SystemPingMessage)msg).Sequence), output);
                break;

            case SystemMessageType.IdentityResponse:
                ByteUtils.Write(DataConverter.Converter.GetBytes(((SystemIdentityResponseMessage)msg).Identity), output);
                break;
            }
        }