Ejemplo n.º 1
0
        public static Package MessageToPackage(Message message, short seq)
        {
            Package package = new Package();

            package.content  = PBConverter.Serialize(message);
            package.head.seq = IPAddress.HostToNetworkOrder(seq);
            package.head.len = IPAddress.HostToNetworkOrder(
                (short)(package.content.Length + 2 * sizeof(short)));
            return(package);
        }
Ejemplo n.º 2
0
        public static Message PackageToMessage(Package package)
        {
            Message message = PBConverter.Deserialize <Message>(package.content);

            return(message);
        }