<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)

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 无码人妻一区二区三区免费手机 | 2021在线永久免费视频| 亚洲精品国产福利一二区| 日韩国产欧美亚洲v片| 国产成人免费高清激情视频| 亚洲毛片免费观看| ww4545四虎永久免费地址| 亚洲精品美女在线观看播放| 在线永久看片免费的视频| 亚洲国产精品久久人人爱| 免费视频爱爱太爽了| 久久狠狠爱亚洲综合影院| 久久精品无码一区二区三区免费| 亚洲人成网国产最新在线| 免费看的一级毛片| 国产成人综合亚洲| 国产成人精品曰本亚洲79ren| 中文字幕不卡免费高清视频| 亚洲精品无码不卡在线播放HE| 国产真人无码作爱视频免费| 亚洲国产精品一区| 免费在线观看的网站| 在线看亚洲十八禁网站| 亚洲日韩精品无码专区网址 | 国产91色综合久久免费| 亚洲人成色4444在线观看| 免费国产怡红院在线观看| 精品一区二区三区免费视频 | 亚洲第一成年免费网站| 偷自拍亚洲视频在线观看99| 狠狠综合久久综合88亚洲| 免费无码又爽又刺激高潮视频| 亚洲天堂2016| 亚洲人成色7777在线观看不卡 | 日本无吗免费一二区| 久久久久久噜噜精品免费直播| 麻豆亚洲AV永久无码精品久久| 最近中文字幕mv手机免费高清 | 99精品视频在线免费观看| 中文字幕亚洲情99在线| 亚洲中文字幕无码不卡电影|