<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 閱讀(977) 評論(0)  編輯  收藏

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


    網(wǎng)站導(dǎo)航:
     

    常用鏈接

    留言簿(5)

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 大学生美女毛片免费视频| 国产日韩AV免费无码一区二区| 99视频在线看观免费| 亚洲成a人片77777kkkk| 日韩精品无码免费专区午夜 | 国产精品久久香蕉免费播放| 亚洲午夜无码毛片av久久京东热| 拨牐拨牐x8免费| 亚洲成a人无码亚洲成www牛牛 | 中文字幕亚洲日韩无线码| 国产大片免费天天看| 国产亚洲精品资源在线26u| 13小箩利洗澡无码视频网站免费| 亚洲国产成人片在线观看无码| 日韩电影免费观看| 91亚洲精品第一综合不卡播放| 国产成人精品免费午夜app | 久久精品亚洲日本波多野结衣| 亚洲AV日韩精品一区二区三区| 一级成人生活片免费看| 亚洲国产精品无码久久久不卡| 96免费精品视频在线观看| 亚洲一区二区三区免费观看| 日本免费中文字幕在线看| 国产精品高清免费网站| 亚洲人成电影在在线观看网色| 丁香花免费完整高清观看 | 99热亚洲色精品国产88| 国产在线a不卡免费视频| 中文字字幕在线高清免费电影| 亚洲人成电影在线天堂| 永久黄网站色视频免费| 99免费在线视频| 色偷偷亚洲女人天堂观看欧| 免费jjzz在在线播放国产| 日韩电影免费在线观看| 亚洲欧美国产精品专区久久| 久久亚洲av无码精品浪潮| 在线精品一卡乱码免费| 羞羞视频在线观看免费| 亚洲美女视频一区|