Example #1
0
            public int Size()
            {
                int size = 0;

                size += Gobuf.VarintSize(this.C);
                return(size);
            }
Example #2
0
        public void Send(byte serviceId, byte messageId, byte[] content)
        {
            try {
                byte[] buffer = new byte[packetHeadSize + content.Length];
                int    n      = 0;
                Gobuf.WriteUint32((uint)content.Length, buffer, ref n);
                buffer[n++] = serviceId;
                buffer[n++] = messageId;

                Buffer.BlockCopy(content, 0, buffer, n, content.Length);
                this.stream.BeginWrite(buffer, 0, buffer.Length, new AsyncCallback(SendCallback), this.stream);
            } catch (Exception e) {
                Console.WriteLine(e);
                this.Close();
            }
        }
Example #3
0
 public int Unmarshal(byte[] b, int n)
 {
     this.C = Gobuf.ReadVarint(b, ref n);
     return(n);
 }
Example #4
0
 public int Marshal(byte[] b, int n)
 {
     Gobuf.WriteVarint(this.C, b, ref n);
     return(n);
 }