Example #1
0
        static void Main()
        {
            uint E_DIV_ZERO = Registry.RegisterException(1);

            uint CC_ADD = Registry.RegisterClientCall(1, "ii", "i");
            uint CC_DIV = Registry.RegisterClientCall(2, "uu", "f", new uint[] { E_DIV_ZERO });
            uint CC_CONCAT = Registry.RegisterClientCall(3, "(s)", "s");

            // Connect
            Connection conn = new Connection("localhost", 8001);

            conn.OnOpen += delegate {
                Console.WriteLine("Connected");

                // Send simple request
                DataArray pack = new DataArray("s");
                pack.AddData(new Data("One"));
                pack.AddData(new Data("Two"));
                pack.AddData(new Data("áçêñtòs\u26C4"));
                conn.SendCall(CC_CONCAT, new Data().AddDataArray(pack), delegate(Connection _, object data) {
                    Console.WriteLine((string)data == "One + Two + áçêñtòs⛄");
                    conn.End();
                });
            };

            conn.OnClose += delegate {
                Console.WriteLine("Closed");
            };

            Console.Read();
        }
Example #2
0
 /// <summary>
 /// Create a new args bag
 /// </summary>
 /// <param name="type">The type of this call</param>
 /// <param name="data">The inflated data</param>
 /// <param name="conn">The connection that created this bag</param>
 /// <param name="call">The call definition</param>
 /// <param name="callId">The call sequence id</param>
 internal CallEventArgs(Registry.RegisteredCall call, object data, Connection conn, uint callId)
 {
     Data = data;
     Conn = conn;
     Call = call;
     CallId = callId;
 }