Esempio n. 1
0
        private void ReceiveMessage(object client)
        {
            Socket clientSocket = (Socket)client;

            while (true)
            {
                try
                {
                    //获取从客户端发来的数据
                    int length = clientSocket.Receive(buffer);
                    if (length > 0)
                    {
                        string cmd        = Encoding.UTF8.GetString(buffer, 0, length);
                        var    proResult  = MyDataFormat.ParseInputJson(cmd, _env);
                        string outputJson = MyDataFormat.ParseOutput(proResult);
                        Console.WriteLine(cmd);
                        clientSocket.Send(Encoding.UTF8.GetBytes(outputJson));
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    clientSocket.Shutdown(SocketShutdown.Both);
                    clientSocket.Close();
                    break;
                }
            }
        }
Esempio n. 2
0
        static public List <Dictionary <int, Vector3> > ParseInputJson(string paramsJson, MyEnvironment env)
        {
            ReceiveJson param = JsonConvert.DeserializeObject <ReceiveJson>(paramsJson);
            List <Dictionary <int, Vector3> > Result = env.StepsMove(param.steps, param.steps_pic, param.step_time, param.G);

            //进行投影校正
            var corrected = MyDataFormat.Projection(Result, param);

            return(corrected);
        }