public static void sendToServer(NMSG msg, int channelId)
        {
            int BYTE_SIZE = 1024;

            byte[]          buffer    = new byte[BYTE_SIZE];
            BinaryFormatter formatter = new BinaryFormatter();
            MemoryStream    ms        = new MemoryStream(buffer);

            formatter.Serialize(ms, msg);     //error occur here.
        }
Example #2
0
        public static void sendToServer(NMSG msg, int channelId)
        {
            int BYTE_SIZE = 1024;

            byte[]          buffer    = new byte[BYTE_SIZE];
            BinaryFormatter formatter = new BinaryFormatter();
            MemoryStream    ms        = new MemoryStream(buffer);

            formatter.Serialize(ms, msg);
            Console.WriteLine(ms.Position);
        }