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

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 99久久婷婷免费国产综合精品| av成人免费电影| 可以免费观看的毛片| 国产又大又长又粗又硬的免费视频| 亚洲国产精品无码久久SM| 国产天堂亚洲精品| 国国内清清草原免费视频99| 久久精品国产精品亚洲艾| 男女男精品网站免费观看 | 久久久久久精品免费免费自慰| 亚洲精品和日本精品| 亚洲精品国产suv一区88| 久久久久av无码免费网| 国产精品国产亚洲精品看不卡| 特级毛片A级毛片免费播放| 成人影片麻豆国产影片免费观看| 久久精品国产亚洲av影院| 99久久免费国产精精品| 亚洲国产综合精品中文字幕| 亚洲国产精品嫩草影院| 黄页网站在线观看免费高清| 亚洲国产人成网站在线电影动漫 | 久99久精品免费视频热77| 国产午夜亚洲精品国产成人小说| 国产精品亚洲专一区二区三区 | 亚洲无人区一区二区三区| 污污的视频在线免费观看| 青青草国产免费久久久91| 亚洲宅男精品一区在线观看| h视频在线观看免费完整版| 亚洲视频在线一区| 一级毛片免费毛片一级毛片免费 | 免费AA片少妇人AA片直播| 日韩精品一区二区亚洲AV观看| 在线成人精品国产区免费| 亚洲中久无码永久在线观看同| 免费无码AV一区二区| 亚洲av再在线观看| 特色特黄a毛片高清免费观看| yy6080久久亚洲精品| 香港一级毛片免费看|