<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

     public static void StartClient()
            {
                // Data buffer for incoming data.
                byte[] bytes = new byte[1024];

                // Connect to a remote device.
                try
                {
                    // Establish the remote endpoint for the socket.
                    // This example uses port 11000 on the local computer.
                    IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
                    IPAddress ipAddress = ipHostInfo.AddressList[0];
                    IPEndPoint remoteEP = new IPEndPoint(ipAddress, 11000);

                    // Create a TCP/IP  socket.
                    Socket sender = new Socket(AddressFamily.InterNetwork,
                       SocketType.Stream, ProtocolType.Tcp);
                    // Connect the socket to the remote endpoint. Catch any errors.
                    try
                    {
                        sender.Connect(remoteEP);

                        Console.WriteLine("Socket connected to {0}",
                           sender.RemoteEndPoint.ToString());

                        string tempStr = GetContent(Console.ReadLine());
                        while (true)
                        {

                      

                       
                            Console.WriteLine("輸入信息");


                            // Encode the data string into a byte array.
                            byte[] msg = Encoding.GetEncoding("gb2312").GetBytes(tempStr + "<EOF>");


                            // Send the data through the socket.
                            int bytesSent = sender.Send(msg);

                            // Receive the response from the remote device.
                            int bytesRec = sender.Receive(bytes);
                            Console.WriteLine("Echoed test = {0}",
                                Encoding.ASCII.GetString(bytes, 0, bytesRec));
                     
                            Console.WriteLine("輸入信息 輸入e退出");
                            tempStr = GetContent(Console.ReadLine());
                             if (tempStr == "e")
                                 break;
                        }
                        // Release the socket.
                        sender.Shutdown(SocketShutdown.Both);
                        sender.Close();

                    }
                    catch (ArgumentNullException ane)
                    {
                        Console.WriteLine("ArgumentNullException : {0}", ane.ToString());
                    }
                    catch (SocketException se)
                    {
                        Console.WriteLine("SocketException : {0}", se.ToString());
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Unexpected exception : {0}", e.ToString());
                    }

                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
               
            }  

    posted on 2011-01-11 13:18 sanmao 閱讀(975) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     

    常用鏈接

    留言簿(5)

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 成人免费一区二区三区在线观看| 亚洲乱码一二三四区国产| 最近中文字幕mv免费高清电影| 国产精品成人69XXX免费视频| 亚洲爆乳少妇无码激情| 久久亚洲精精品中文字幕| 国产成人精品日本亚洲专区61 | 久久久久久亚洲精品不卡| 成人黄页网站免费观看大全| 99爱免费观看视频在线| 中文字幕视频在线免费观看| 色哟哟国产精品免费观看| 亚洲成a人无码亚洲成www牛牛 | 丁香花在线观看免费观看图片 | 午夜免费福利网站| 免费精品国产日韩热久久| 久久精品乱子伦免费| a级毛片免费全部播放| 丁香花在线观看免费观看图片| 黄色毛片免费网站| 美女18一级毛片免费看| 久久精品国产亚洲AV| 国产精品亚洲AV三区| 美女扒开屁股让男人桶爽免费| 亚洲精品色播一区二区| 亚洲国产精品精华液| 亚洲av中文无码乱人伦在线观看| 亚洲日韩乱码中文字幕| 亚洲国产精品18久久久久久| 亚洲AV成人无码久久WWW| 亚洲av无码片vr一区二区三区| 亚洲AV性色在线观看| 亚洲av日韩aⅴ无码色老头| 久久精品国产亚洲av品善| 猫咪免费观看人成网站在线| 激情吃奶吻胸免费视频xxxx| 一级毛片高清免费播放| a级男女仿爱免费视频| 久久国产免费一区二区三区| 在线免费观看你懂的| 亚洲成在人线aⅴ免费毛片|