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

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 一级做a爰片性色毛片免费网站 | 国产成人+综合亚洲+天堂| 114级毛片免费观看| 美女裸体无遮挡免费视频网站| 亚洲国产成人久久综合一 | 少妇中文字幕乱码亚洲影视| 亚洲?v女人的天堂在线观看| 亚洲大片免费观看| 国产一级一毛免费黄片| 精品亚洲福利一区二区| 四虎影视精品永久免费| 野花高清在线观看免费完整版中文| 亚洲大片免费观看| 亚洲天天在线日亚洲洲精| 亚洲中文字幕日产乱码高清app| 永久免费av无码网站大全| 无码乱肉视频免费大全合集| 今天免费中文字幕视频| 国产又黄又爽又大的免费视频| 日韩色日韩视频亚洲网站| 亚洲中文无码mv| 亚洲欧洲日韩极速播放| 亚洲理论在线观看| 亚洲永久中文字幕在线| 麻豆亚洲AV永久无码精品久久| 亚洲伊人久久精品影院| 亚洲真人无码永久在线| 久久99亚洲综合精品首页| 亚洲精品国产高清不卡在线| 免费在线观看一级毛片| 免费不卡中文字幕在线| 免费一级特黄特色大片在线| 夜色阁亚洲一区二区三区| 免费一看一级毛片全播放| 免费女人18毛片a级毛片视频| 免费h黄肉动漫在线观看| 男人的天堂亚洲一区二区三区 | 亚洲男人天堂2020| 亚洲综合久久夜AV | 久久国产成人亚洲精品影院| 国产精品xxxx国产喷水亚洲国产精品无码久久一区 |