Beispiel #1
0
        public void RunTest(MediaFunction function)
        {
            int result = function();

            if (result == 0)
            {
                Console.WriteLine("Works!");
            }
            else
            {
                Console.WriteLine("Failed.");
            }
        }
Beispiel #2
0
        public bool PlayMedias(string tvname, string type, string setname, string asbgm)
        {
            MediaFunction media = new MediaFunction();
            Dictionary <string, List <MediaMengMeng> > d = null;

            if (type.Equals("audio"))
            {
                d = media.GetAudioSet();
            }
            else if (type.Equals("image"))
            {
                d = media.GetImageSet();
            }

            if (!d.ContainsKey(setname))
            {
                return(false);
            }
            else
            {
                List <string>        urls = new List <string>();
                List <MediaMengMeng> l    = d[setname];
                foreach (MediaMengMeng m in l)
                {
                    info.media.MediaItem mi = new info.media.MediaItem(m.pathName);
                    urls.Add(mi.url);
                }
                foreach (info.tv.TVInfo item in MyInfo.tvLibrary.value)
                {
                    if (item.name.Equals(tvname))
                    {
                        function.tv.TVFunction.sendCommand(item.ip, info.tv.TVCommand.GetInstance("CONTROL_MEDIA", "IMAGE_BACKGROUND_MUSIC", false, "", type, urls, null));
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #3
0
        //public class JoPaths
        //{
        //    public string getpath { get; set; }
        //}

        public async void handle(Object myClientSocket)
        {
            Socket ClientSocket = null;

            try
            {
                ClientSocket = (Socket)myClientSocket;
                Projection    projection = new Projection();
                WindowControl wc         = new WindowControl();
                Applacation   app        = new Applacation();
                MediaFunction media      = new MediaFunction();
                Game          game       = new Game();
                Response      response   = null;

                //test = windows.BackGroundWindow.Instance();
                Console.WriteLine("name is:{0}", name);
                log.Info(string.Format("接收到手机发来的指令 name = {0},command = {1},param = {2}", name, command, param));
                switch (name)
                {
                case CommandName.PC:
                    if (command.Equals("AddDirsHTTP"))
                    {
                        string status = null;
                        bool   flag   = true;
                        Console.WriteLine("paths is:{0}", param["paths"]);
                        String[] pathlist = param["paths"].Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries);

                        //List<JoPaths> pathlist = JsonConvert.DeserializeObject<List<JoPaths>>(param["paths"]);
                        //List<JoPaths> err_pathlist = new List<JoPaths>();
                        //String[] err_pathlist = null;
                        List <string> err_pathlist = new List <string>();
                        foreach (string path in pathlist)
                        {
                            Console.WriteLine("path is:{0}" + path);
                            string dirPath = path;
                            if (File.Exists(dirPath) || Directory.Exists(dirPath))
                            {
                                if (Directory.Exists(dirPath))
                                {
                                    DirectoryInfo Folder = new DirectoryInfo(dirPath);
                                    foreach (FileInfo file in Folder.GetFiles())
                                    {
                                        if (File.Exists(file.FullName))
                                        {
                                            Console.WriteLine("file fullname_1 is:{0}", file.FullName);
                                            Node node = new Node(file.FullName);
                                            NodeContainer.addNode(node);
                                        }
                                    }
                                }
                                else
                                {
                                    FileInfo file = new FileInfo(dirPath);
                                    Console.WriteLine("file fullname_2 is:{0}", file.FullName);
                                    Node node = new Node(file.FullName);
                                    NodeContainer.addNode(node);
                                }
                                Console.WriteLine("status:200");
                            }
                            else
                            {
                                flag = false;
                                err_pathlist.Add(path);
                                Console.WriteLine("status:404");
                            }
                        }
                        if (flag)
                        {
                            status = "200";
                        }
                        else
                        {
                            status = "404";
                        }
                        //string errpaths = "{\"errorPaths:\"" + "\"" + err_pathlist +"\"}";
                        response = new Response(status, "", CommandName.PC, err_pathlist);
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("close"))
                    {
                        Environment.Exit(0);
                    }
                    else if (command.Equals("SEARCH"))
                    {
                        string key = param["key"];
                        List <MediaMengMeng> allmedia = util.config.MediaConfig.SearchAll(key);
                        response = new Response("200", "", CommandName.PC, JsonConvert.SerializeObject(allmedia));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.VIDEO:
                    if (command.Equals("PLAY"))
                    {
                        PlayMedia(param["tvname"], param["path"]);
                        media.AddRecentMeiaList(new MediaItem(param["path"]));
                        response = new Response("200", "", CommandName.VIDEO, null);    //////////////////////////////////////
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETTOTALLIST"))
                    {
                        response = new Response("200", "", CommandName.VIDEO, JsonConvert.SerializeObject(media.getMediasByPath("VIDEO", param["folder"])));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETRECENTLIST"))
                    {
                        response = new Response("200", "", CommandName.VIDEO, JsonConvert.SerializeObject(media.GetRecentVideoList()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("DELETE"))
                    {
                        if (media.DeletMyMediaLibrary("UserVideoConfig", param["folder"]))
                        {
                            response = new Response("200", "DELETE_SUCCESS", CommandName.VIDEO, null);
                        }
                        else
                        {
                            response = new Response("404", "DELETE_FAILED", CommandName.VIDEO, null);
                        }

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }

                    break;

                case CommandName.AUDIO:
                    if (command.Equals("PLAY"))
                    {
                        PlayMedia(param["tvname"], param["path"]);
                        media.AddRecentMeiaList(new MediaItem(param["path"]));
                        response = new Response("200", "", CommandName.AUDIO, null);
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETTOTALLIST"))
                    {
                        response = new Response("200", "", CommandName.AUDIO, JsonConvert.SerializeObject(media.getMediasByPath("AUDIO", param["folder"])));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETRECENTLIST"))
                    {
                        response = new Response("200", "", CommandName.AUDIO, JsonConvert.SerializeObject(media.GetRecentAudioList()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETSETS"))
                    {
                        response = new Response("200", "", CommandName.AUDIO, JsonConvert.SerializeObject(media.GetAudioSet()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("ADDSET"))
                    {
                        if (media.AddAudioSet(param["setname"]))
                        {
                            response = new Response("200", "", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.AUDIO, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("ADDFILESTOSET"))
                    {
                        string s = param["liststr"];
                        if (media.AddAudioSet(param["setname"], JsonConvert.DeserializeObject <List <MediaMengMeng> >(s)))
                        {
                            response = new Response("200", "", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.AUDIO, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("DELETESET"))
                    {
                        if (media.DeleteAudiSet(param["setname"]))
                        {
                            response = new Response("200", "", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.AUDIO, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("PLAYSET"))
                    {
                        bool re;
                        //if (!param.ContainsKey("asBGM"))
                        //{
                        //    re = PlayMedias(param["tvname"], "audio", param["setname"]);
                        //}
                        //else
                        //{
                        re = PlayMedias(param["tvname"], "audio", param["setname"]);
                        //}
                        if (re)
                        {
                            List <MediaMengMeng> list = media.GetAudioSet()[param["setname"]];
                            if (list.Count < 10)
                            {
                                foreach (MediaMengMeng m in list)
                                {
                                    media.AddRecentAudioList(m);
                                }
                            }
                            else
                            {
                                for (int i = list.Count - 10; i < list.Count; i++)
                                {
                                    media.AddRecentAudioList(list[i]);
                                }
                            }
                            response = new Response("200", "", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.AUDIO, null);
                        }

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("PLAYSETASBGM"))
                    {
                        bool re;
                        re = PlayMedias(param["tvname"], "audio", param["setname"], null);
                        if (re)
                        {
                            List <MediaMengMeng> list = media.GetAudioSet()[param["setname"]];
                            if (list.Count < 10)
                            {
                                foreach (MediaMengMeng m in list)
                                {
                                    media.AddRecentAudioList(m);
                                }
                            }
                            else
                            {
                                for (int i = list.Count - 10; i < list.Count; i++)
                                {
                                    media.AddRecentAudioList(list[i]);
                                }
                            }
                            response = new Response("200", "", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.AUDIO, null);
                        }

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("DELETE"))
                    {
                        if (media.DeletMyMediaLibrary("UserAudioConfig", param["folder"]))
                        {
                            response = new Response("200", "DELETE_SUCCESS", CommandName.AUDIO, null);
                        }
                        else
                        {
                            response = new Response("404", "DELETE_FAILED", CommandName.AUDIO, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.IMAGE:
                    if (command.Equals("PLAY"))
                    {
                        PlayMedia(param["tvname"], param["path"]);
                        response = new Response("200", "", CommandName.IMAGE, null);
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("PLAYALL"))
                    {
                        List <MediaMengMeng> l    = media.getMediasByPath("IMAGE", param["folder"]);
                        List <string>        urls = new List <string>();

                        foreach (MediaMengMeng m in l)
                        {
                            info.media.MediaItem mi = new info.media.MediaItem(m.pathName);
                            urls.Add(mi.url);
                        }
                        foreach (info.tv.TVInfo item in MyInfo.tvLibrary.value)
                        {
                            if (item.name.Equals(param["tvname"]))
                            {
                                function.tv.TVFunction.sendCommand(item.ip, info.tv.TVCommand.GetInstance("OPEN_HTTP_MEDIA", null, false, "", "image", urls, null));
                            }
                        }
                        //foreach (var ls in list)
                        //{
                        //    PlayMedia(param["tvname"], ls[""]);
                        //}


                        response = new Response("200", "", CommandName.IMAGE, null);
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETTOTALLIST"))
                    {
                        List <MediaMengMeng> list = media.getMediasByPath("IMAGE", param["folder"]);
                        response = new Response("200", "", CommandName.IMAGE, JsonConvert.SerializeObject(list));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETSETS"))
                    {
                        response = new Response("200", "", CommandName.IMAGE, JsonConvert.SerializeObject(media.GetImageSet()));

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("ADDSET"))
                    {
                        if (media.AddImageSet(param["setname"]))
                        {
                            response = new Response("200", "", CommandName.IMAGE, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.IMAGE, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("ADDFILESTOSET"))
                    {
                        string s = param["liststr"];
                        if (media.AddImageSet(param["setname"], JsonConvert.DeserializeObject <List <MediaMengMeng> >(s)))
                        {
                            response = new Response("200", "", CommandName.IMAGE, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.IMAGE, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("DELETESET"))
                    {
                        if (media.DeleteImageSet(param["setname"]))
                        {
                            response = new Response("200", "", CommandName.IMAGE, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.IMAGE, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("PLAYSET"))
                    {
                        bool re = PlayMedias(param["tvname"], "image", param["setname"]);
                        if (re)
                        {
                            List <MediaMengMeng> list = media.GetImageSet()[param["setname"]];
                            if (list.Count < 10)
                            {
                                foreach (MediaMengMeng m in list)
                                {
                                    media.AddRecentImageList(m);
                                }
                            }
                            else
                            {
                                for (int i = list.Count - 10; i < list.Count; i++)
                                {
                                    media.AddRecentImageList(list[i]);
                                }
                            }
                            response = new Response("200", "", CommandName.IMAGE, null);
                        }
                        else
                        {
                            response = new Response("404", "", CommandName.IMAGE, null);
                        }

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("DELETE"))
                    {
                        if (media.DeletMyMediaLibrary("UserImageConfig", param["folder"]))
                        {
                            response = new Response("200", "DELETE_SUCCESS", CommandName.VIDEO, null);
                        }
                        else
                        {
                            response = new Response("404", "DELETE_FAILED", CommandName.VIDEO, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.APP:
                    if (command.Equals("GETTOTALLIST"))
                    {
                        response = new Response("200", "", CommandName.APP, JsonConvert.SerializeObject(app.GetAppList()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("OPEN_RDP"))
                    {
                        if ((string)param["path"] == "back")
                        {
                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                System.Windows.Window test = windows.BackGroundWindow.Instance();
                                test.Hide();
                            }));
                            app.CloseAll();
                            Type   oleType   = Type.GetTypeFromProgID("Shell.Application");
                            object oleObject = System.Activator.CreateInstance(oleType);
                            oleType.InvokeMember("ToggleDesktop", BindingFlags.InvokeMethod, null, oleObject, null);
                        }
                        else
                        {
                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                System.Windows.Window test = windows.BackGroundWindow.Instance();
                                test.Show();
                            }));
                            app.OpenApp((string)param["path"], "");
                        }
                    }
                    else if (command.Equals("OPEN_MIRACAST"))
                    {
                        //WindowControl.SetTaskBarState(0);
                        if (!projection.IsConnection())
                        {
                            app.CloseAll();
                            //projection.EnterQS();
                            //projection.ClosePopup();
                        }
                        Process pro;
                        pro = app.OpenApp((string)param["path"], "");
                        //Console.WriteLine(System.Windows.Forms.Screen.AllScreens.Last());
                        DeviceItem item = util.config.UserScreenConfig.GetScreen(param["tvname"]);
                        if (item != null)
                        {
                            await projection.SelectProjectionDevice(item.screen);

                            wc.MoveWindow(pro, System.Windows.Forms.Screen.AllScreens.Last(), true);
                            response = new Response("200", "", CommandName.APP, null);
                        }
                        else
                        {
                            response = new Response("404", "don't have set miracast", CommandName.APP, null);
                        }
                        //projection.ClearMiracastPopup();

                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.GAME:
                    if (command.Equals("GETTOTALLIST"))
                    {
                        response = new Response("200", "", CommandName.GAME, JsonConvert.SerializeObject(game.GetGameList()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("OPEN"))
                    {
                        game.OpenGame(param["path"], "");
                        response = new Response("200", "", CommandName.GAME, null);
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.SYS:
                    if (command.Equals("GETINFOR"))
                    {
                        response = new Response("200", "", CommandName.SYS, JsonConvert.SerializeObject(function.pcapp.PCInformation.GetInstance()));
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    else if (command.Equals("GETSCREENSTATE"))
                    {
                        if (MyInfo.IsSreenLock)
                        {
                            response = new Response("404", "", CommandName.SYS, null);
                        }
                        else
                        {
                            response = new Response("200", "", CommandName.SYS, null);
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;

                case CommandName.SECURITY:
                    if (command.Equals("PAIR"))
                    {
                        string code = param["code"];
                        if (code.Equals(PairCodeConfig.GetPairCode()))
                        {
                            response = new Response("200", "", CommandName.SECURITY, "true");
                        }
                        else
                        {
                            response = new Response("200", "", CommandName.SECURITY, "false");
                        }
                        ClientSocket.Send(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(response)));
                    }
                    break;
                }
                log.InfoFormat("Command 接受到的命令:  {0},返回的结果:  {1}", JsonConvert.SerializeObject(this), JsonConvert.SerializeObject(response));
                ClientSocket.Close();
            }
            catch (Exception e)
            {
                if (ClientSocket != null)
                {
                    ClientSocket.Close();
                }
                log.Error("Comand 执行出错", e);
            }
        }
Beispiel #4
0
        public static void Main1(string[] args)
        {
            bool isOpen = false;

            function.window.WindowControl.SetTaskbarState(function.window.WindowControl.AppBarStates.AutoHide); //隐藏任务栏
            InitLog4Net();                                                                                      //初始化日志
            ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

            log.Info(string.Format("通过连接8.8.8.8获得的ip为:{0}", ip));
            try
            {
                IpExit(ip);
                log.Info("当前正在使用的IP为:" + ip);
            }
            catch (Exception e)
            {
                log.Info(string.Format("捕获异常:{0}", e.Message));
            }

            TVFunction tv = new TVFunction();

            tv.Start();                           //启动tv线程,检测TV是否在线
            isOpen = function.pcapp.PCApp.Open(); //打开其他PC应用
            int i = 0;

            while (!isOpen)
            {
                function.pcapp.PCApp.CLoseAll();
                isOpen = function.pcapp.PCApp.Open();
                if (i == 2)
                {
                    if (MessageBox.Show("您的Areaparty在上次运行中发生异常,请点击确定重置软件相关参数。", "重置", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        function.pcapp.PCApp.CLoseAll();
                        //System.Windows.Application.Current.Shutdown();
                        //System.Windows.Forms.Application.Exit();
                        Environment.Exit(0);
                    }
                }
                i++;
            }
            //Thread.Sleep(3000);//必须等待一段时间,下个模块初始化依赖于上个模块。

            MediaFunction media = new MediaFunction();

            media.init();//初始化多媒体,将媒体库和缩略图添加到HTTP服务器



            Phone phone = new Phone();

            phone.start();//开启手机线程,接受广播

            Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(SystemEvents_SessionSwitch);

            byte[] result       = new byte[1024];
            Socket serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            serverSocket.Bind(new IPEndPoint(IPAddress.Any, info.ConfigResource.MYSERVER_PORT)); //绑定IP地址:端口
            serverSocket.Listen(40);                                                             //设定最多40个排队连接请求
            //Console.WriteLine("启动监听{0}成功", serverSocket.LocalEndPoint.ToString());
            log.Info(String.Format("启动监听{0}成功", serverSocket.LocalEndPoint.ToString()));
            //通过Clientsoket发送数据
            while (true)
            {
                //Console.WriteLine("等待连接");
                Socket myClientSocket = serverSocket.Accept();
                log.Info(String.Format("{0}使用端口{1}连接成功", ((System.Net.IPEndPoint)myClientSocket.RemoteEndPoint).Address, ((System.Net.IPEndPoint)myClientSocket.RemoteEndPoint).Port));
                //Console.WriteLine("{0}使用端口{1}连接成功", ((System.Net.IPEndPoint)myClientSocket.RemoteEndPoint).Address, ((System.Net.IPEndPoint)myClientSocket.RemoteEndPoint).Port);
                try
                {
                    //通过clientSocket接收数据
                    int    receiveNumber = myClientSocket.Receive(result);
                    string rev           = Encoding.UTF8.GetString(result, 0, receiveNumber);
                    log.Info(String.Format("接受客户端{0}发送过来的消息: {1}", ((System.Net.IPEndPoint)myClientSocket.RemoteEndPoint).Address, rev));
                    //Console.WriteLine("接受客户端{0}发送过来的消息: {1}", ((System.Net.IPEndPoint)myClientSocket.RemoteEndPoint).Address, rev);
                    if (receiveNumber <= 0)
                    {
                        myClientSocket.Close();
                        continue;
                    }
                    //验证数据是tv还是手机传来,如果是tv,则转发给原来处理程序处理。
                    JsonTextReader reader = new JsonTextReader(new StringReader(rev));
                    JObject        obj    = JObject.Parse(rev);
                    if (obj.Property("source") != null)//phone发过来有关tv的消息,依然交给phone处理模块
                    {
                        phone.FuncMSG(rev);
                        myClientSocket.Close();
                        continue;
                    }

                    Command com = JsonConvert.DeserializeObject <Command>(rev);
                    Thread  t   = new Thread(new ParameterizedThreadStart(com.handle));
                    t.Start(myClientSocket);
                }
                catch (Exception ex)
                {
                    log.Error("网络连接错误或者接受的数据格式不对", ex);
                    //Console.WriteLine(ex.Message);
                    //myClientSocket.Shutdown(SocketShutdown.Both);
                    myClientSocket.Close();
                }
            }
        }