//Client example static void Main(string[] args) { //Create a list to store callbacks. List <RSN_Client_CallbackConfig> callbacks = new List <RSN_Client_CallbackConfig>(); //Add the callback Test with ID 1 to the list. callbacks.Add(new RSN_Client_CallbackConfig(1, typeof(RSN_Example_SimpleClass))); //Create the client and log in with password "hello". //If there is an error, ErrorHandle will be called client = RSN_Client.Connect(callbacks.ToArray(), "hello", "10.0.1.13", 13000, new RSN_Error(ErrorHandle)); //Await enter press Console.ReadLine(); //Create some data to send RSN_Example_SimpleClass example = new RSN_Example_SimpleClass(); example.name = "Bob"; //Send the data client.SendData(new RSN_ClientResponse(Test), example); //Await ENTER Console.ReadLine(); }
static void Test(object obj, RSN_ServerResponse_Data data) { //Deserialize RSN_Example_SimpleClass example = (RSN_Example_SimpleClass)obj; //Print the name of the person Console.WriteLine(example.name); //Create a new class and add placeholder data example = new RSN_Example_SimpleClass(); example.name = "Larry"; //Respond data.Respond(example); }
static void Test(object data) { //The general prodedure here would be to cast this to the correct class. //Deserialize RSN_Example_SimpleClass example = (RSN_Example_SimpleClass)data; //Print Console.WriteLine(example.name); //Create a new class to send example = new RSN_Example_SimpleClass(); //Send some example data example.name = "Bob"; //Respond with this class. client.SendData(new RSN_ClientResponse(Test), example); }