Esempio n. 1
0
        // static async void start_server()
        // {
        //     System.Console.WriteLine("Server started");
        //     Socket sock = await get_client_socket();
        //     System.Console.WriteLine("client socket connected");

        //     // byte[] holding_buffer = new byte[buffer_size];

        //     TcpResource r = new TcpResource(buffer_size, sock);
        //     IPausableDataSender reciver = new PausableDataSender(r);

        //     byte[] a = Encoding.UTF8.GetBytes("a");

        //     while (true)
        //     {
        //         byte[] data = new byte[buffer_size];
        //         r.Receive(data);
        //         string data_in_string = Encoding.UTF8.GetString(data);
        //         System.Console.WriteLine(data_in_string);
        //         byte[] buffer = BitConverter.GetBytes(a.Length);
        //         byte[] res = buffer.Concat(a).ToArray();
        //         r.Send(res, 0, res.Length);
        //     }
        // }

        static int send_data(INetworkingManager <DataWithAttributes> m, string content, int priority)
        {
            TextData d = new TextData();

            d.Content  = content;
            d.DataType = "TextData";
            return(m.AddDataToSendPool(d, priority));
        }
Esempio n. 2
0
 public OnAck(INetworkingManager <DataWithAttributes> network_manager)
 {
     this._network_manager = network_manager;
     _parser_helper        = new JsonParserHelper();
 }