Esempio n. 1
0
 public void PadTo32Bits(int len, NetworkSerializer serializer)
 {
     while (((len++) % 4) != 0)
     {
         serializer.Write((byte)0);
     }
 }
Esempio n. 2
0
        public void WriteChangeRequest(bool changeIP, bool changePort)
        {
            serializer.SetBufferLength(0);

            serializer.Write((ushort)STUNAttribute.ChangeRequest);
            serializer.Write((ushort)4);

            int flags = (!changeIP ? 0 : (1 << 2)) | (!changePort ? 0 : (1 << 1));

            serializer.Write(flags);

            attributeTypes.Add(STUNAttribute.ChangeRequest);
            attributeBytes.Add(serializer.ToArray());
        }