ITÊýÂë ¹ºÎï ÍøÖ· Í·Ìõ Èí¼þ ÈÕÀú ÔĶÁ ͼÊé¹Ý
TxTС˵ÔĶÁÆ÷
¡ýÓïÒôÔĶÁ,С˵ÏÂÔØ,¹ÅµäÎÄѧ¡ý
ͼƬÅúÁ¿ÏÂÔØÆ÷
¡ýÅúÁ¿ÏÂÔØͼƬ,ÃÀŮͼ¿â¡ý
ͼƬ×Ô¶¯²¥·ÅÆ÷
¡ýͼƬ×Ô¶¯²¥·ÅÆ÷¡ý
Ò»¼üÇå³ýÀ¬»ø
¡ýÇáÇáÒ»µã,Çå³ýϵͳÀ¬»ø¡ý
¿ª·¢: C++֪ʶ¿â Java֪ʶ¿â JavaScript Python PHP֪ʶ¿â È˹¤ÖÇÄÜ Çø¿éÁ´ ´óÊý¾Ý Òƶ¯¿ª·¢ ǶÈëʽ ¿ª·¢¹¤¾ß Êý¾Ý½á¹¹ÓëËã·¨ ¿ª·¢²âÊÔ ÓÎÏ·¿ª·¢ ÍøÂçЭÒé ϵͳÔËά
½Ì³Ì: HTML½Ì³Ì CSS½Ì³Ì JavaScript½Ì³Ì GoÓïÑÔ½Ì³Ì JQuery½Ì³Ì VUE½Ì³Ì VUE3½Ì³Ì Bootstrap½Ì³Ì SQLÊý¾Ý¿â½Ì³Ì CÓïÑÔ½Ì³Ì C++½Ì³Ì Java½Ì³Ì Python½Ì³Ì Python3½Ì³Ì C#½Ì³Ì
ÊýÂë: µçÄÔ ±Ê¼Ç±¾ ÏÔ¿¨ ÏÔʾÆ÷ ¹Ì̬ӲÅÌ Ó²ÅÌ ¶ú»ú ÊÖ»ú iphone vivo oppo СÃ× »ªÎª µ¥·´ ×°»ú ͼÀ­¶¡
 
   -> ÍøÂçЭÒé -> C#ÓÎÏ·¿Í»§¶Ë±à³Ì -> ÕýÎÄÔĶÁ

[ÍøÂçЭÒé]C#ÓÎÏ·¿Í»§¶Ë±à³Ì

Ò»¡¢TCP¿Í»§¶ËÓë·þÎñÆ÷¶ËͨÐÅ

·þÎñÆ÷³õʼ»¯

(1)µ÷ÓÃsocket,´´½¨ÎļþÃèÊö·û
(2)µ÷ÓÃbind,½«ÎļþÃèÊö·ûÓëip/portÁ¬½ÓÆðÀ´¡£Èô¶Ë¿ÚºÅÒѱ»Õ¼ÓÃ,Ôòbindʧ°Ü
(3)µ÷ÓÃlisten,ÉùÃ÷¸ÃÎļþÃèÊö·ûÊÇ·þÎñÆ÷µÄÒ»¸öÎļþÃèÊö·û,Ϊ֮ºóµÄaccept×ö×¼±¸
(4)µ÷ÓÃaccept,²¢´¦ÓÚ×èÈû״̬,µÈ´ý¿Í»§¶ËÁ¬½Ó

½¨Á¢Á¬½Ó

(1)µ÷ÓÃsocket,´´½¨ÎļþÃèÊö·û
(2)µ÷ÓÃconnect,Ïò·þÎñÆ÷·¢ÆðÁ¬½ÓÇëÇó¡£
(3)connect»á·¢ËÍÒ»¸öÇëÇóSYN¶Î²¢×èÈûµÈ´ý·þÎñÆ÷Ó¦´ð(µÚÒ»´Î)
(4)·þÎñÆ÷ÊÕµ½SYN,»á¸ø¿Í»§¶Ë·¢ËÍÒ»¸öÈ·ÈÏÓ¦´ðµÄͬʱ·¢ËÍÒ»¸öÇëÇó(SYN+ACK),±íʾͬÒ⽨Á¢Á¬½Ó(µÚ¶þ´Î)
(5)¿Í»§¶ËÊÕµ½¿Í»§¶Ë·¢µÄSYN+ACK¶Î,±íÃ÷¿Í»§¶ËÁ¬½ÓÒѽ¨Á¢³É¹¦,½øÈëESTABLISHED״̬,´Óconnect()¡£¿Í»§¶ËÔÙÏò·þÎñÆ÷·¢ËÍÒ»¸öACK¶Î,·þÎñÆ÷ÊÕµ½ºóÔò·þÎñÆ÷¶ËÁ¬½ÓÒ²½¨Á¢³É¹¦,·þÎñÆ÷Ò²½øÈëESTABLISHED״̬¡£
ÔÚÕâÀï²åÈëͼƬÃèÊö

Êý¾Ý´«Êä

(1)Á¬½Ó½¨Á¢³É¹¦ºó,ÔÚͬһÁ¬½Ó¡¢Í¬Ò»Ê±¿Ì,ͨÐÅË«·½¿ÉͬʱдÊý¾Ý(È«Ë«¹¤)
(2)·þÎñÆ÷¶Ë´Óaccept()·µ»Øºóµ÷ÓÃread()¿ªÊ¼¶ÁÊý¾Ý,ÈôûÓÐÊý¾ÝÔò×èÈûµÈ´ý
(3)¿Í»§¶Ëµ÷ÓÃwrite()Ïò·þÎñÆ÷·¢ËÍÊý¾ÝÇëÇó,¿Í»§¶ËÊÕµ½Ö®ºóµ÷ÓÃread()´¦ÀíÇëÇó,´Ë¹ý³Ì·þÎñÆ÷µ÷ÓÃread()×èÈûµÈ´ý
(4)·þÎñÆ÷µ÷ÓÃwrite()½«´¦ÀíºÃµÄÇëÇó·¢Ë͸ø¿Í»§¶Ë,Ôٴε÷ÓÃread()µÈ´ýÏÂÒ»¸öÇëÇó
(5)¿Í»§¶ËÊÕµ½ºó´Óread()·µ»Ø,·¢ËÍÏÂÒ»ÌõÇëÇó,Èç´ËÑ­»·ÏÂÈ¥

¶Ï¿ªÁ¬½Ó

(1)ûÓÐÊý¾Ý´¦ÀíÁË,Ôò¿Í»§¶Ëµ÷ÓÃclose()¹Ø±ÕÁ¬½Ó,¸ø·þÎñÆ÷¶Ë·¢ËÍÒ»¸ö¶Ï¿ªÁ¬½ÓÇëÇóFIN¶Î(µÚÒ»´Î)
(2)·þÎñÆ÷ÊÕµ½¿Í»§¶ËµÄFIN¶Î,¸ø¿Í»§¶Ë·¢ËÍÒ»¸öÈ·ÈÏÓ¦´ðACK¶Î±íÃ÷ͬÒâ¶Ï¿ªÁ¬½Ó,¿Í»§¶ËÊÕµ½ACK¶Î²¢µ÷ÓÃread()·µ»Ø0,±íÃ÷¿Í»§¶ËÁ¬½ÓÒѶϿª(µÚ¶þ´Î)
(3)read()·µ»Ø0Ö®ºó,·þÎñÆ÷ÖªµÀ¿Í»§¶ËÒѶϿªÁ¬½Ó,ËüÒ²µ÷ÓÃclose()¹Ø±ÕÁ¬½Ó,¸ø¿Í»§¶Ë·¢ËÍÒ»¸ö¶Ï¿ªÁ¬½ÓÇëÇóFIN¶Î(µÚÈý´Î)
(4)¿Í»§¶Ë½ÓÊÕµ½·þÎñÆ÷¶Ë·¢Ë͵ÄFIN¶Î,¸ø·þÎñÆ÷Ò»¸öÈ·ÈÏÓ¦´ðACK¶Î,±íÃ÷ͬÒâ¶Ï¿ªÁ¬½Ó¡£¿Í»§¶Ë½øÈëTIME_WAIT״̬,·þÎñÆ÷ÊÕµ½¿Í»§¶ËµÄACKºóÔò·þÎñÆ÷¶Ï¿ªÁ¬½Ó¡£
ÔÚÕâÀï²åÈëͼƬÃèÊö

¶þ¡¢±àдÍøÓοͻ§¶Ë

  • ´´½¨ÏîÄ¿
    ÔÚÕâÀï²åÈëͼƬÃèÊö
  • »ù±¾½çÃæÉè¼Æ
    ÔÚÕâÀï²åÈëͼƬÃèÊö
  • ´úÂë
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Net;
using System.Net.Sockets;
using System.Media;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private NetworkStream stream;
        private TcpClient tcpClient;

        SoundPlayer player = new SoundPlayer("D:/Fuchikami/nene/Lopu$ - So Cute~.mp3");
       
        Socket socket_send;
        void send_stream(string str)
        {
            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
            System.Text.Encoding GBK = System.Text.Encoding.GetEncoding("GBK");
            byte[] buffer = GBK.GetBytes(str + "\n");
            stream.Write(buffer, 0, buffer.Length);
        }
       
        void receive_stream()
        {
            byte[] receive_data = new byte[1024];
            //¶¨Òå±àÂë¸ñʽ
            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);//ΪʹÓÃGB2312×ö×¼±¸
            System.Text.Encoding GBK = System.Text.Encoding.GetEncoding("GBK");
            if (stream.CanRead)
            {

                int len = stream.Read(receive_data, 0, receive_data.Length);
                string msg = GBK.GetString(receive_data, 0, receive_data.Length);

                string str = "\r\n";
                char[] str1 = str.ToCharArray();
                string[] messy_code = { "ÿ?ÿ?[2J ", "[5m", "[44m", "[37;0m", "[1;33m", "[1;32m", "[1;31m" };
                string[] msg1 = msg.Split(str1);//ÒÔ»»ÐзûΪ·Ö¸ô·û
                for (int j = 0; j < msg1.Length; j++)//ÖðÐÐÏÔʾ
                {

                    msg1[j] = msg1[j].Replace(messy_code[0], " ");
                    msg1[j] = msg1[j].Replace(messy_code[1], " ");
                    msg1[j] = msg1[j].Replace(messy_code[2], " ");
                    msg1[j] = msg1[j].Replace(messy_code[3], " ");
                    msg1[j] = msg1[j].Replace(messy_code[4], " ");
                    msg1[j] = msg1[j].Replace(messy_code[5], " ");
                    msg1[j] = msg1[j].Replace(messy_code[6], " ");
                    listBox1.Items.Add(msg1[j]);
                }
            }
        }



        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            tcpClient = new TcpClient();
            //Ì×½Ó×Ö½¨Á¢Á¬½Ó


            socket_send = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint point = new IPEndPoint(IPAddress.Parse("10.1.230.74"), 3900);
            socket_send.Connect(point);
            try
            {
                //ÏòÖ¸¶¨µÄIPµØÖ·µÄ·þÎñÆ÷·¢ËÍÁ¬½ÓÇëÇó
                tcpClient.Connect("10.1.230.74", 3900);
                listBox1.Items.Add("Á¬½Ó³É¹¦");
                stream = tcpClient.GetStream();
                receive_stream();//½ÓÊÕ×Ö½ÚÁ÷²¢ÏÔʾÔÚÆÁÄ»ÉÏ

            }
            catch
            {
                listBox1.Items.Add("·þÎñÆ÷δÆô¶¯");
            }
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tcpClient.Connected)
            {
                string action = textBox1.Text.ToString();
                listBox1.Items.Add("ÊäÈëµÄÐÅϢΪ:" + action);
                send_stream(action);
                receive_stream();

            }
            else
            {
                listBox1.Items.Add("Á¬½ÓÒѶϿª");
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {

            if (stream != null)
            {
                stream.Close();
                tcpClient.Close();
                socket_send.Close();
            }
            listBox1.Items.Add("Í˳öÓÎÏ·");
        }

        private void button4_Click(object sender, EventArgs e)
        {
            player.Load();
            player.Play();
        }
     

    }
}

ÔÚÕâÀï²åÈëͼƬÃèÊö

  ÍøÂçЭÒé ×îÐÂÎÄÕÂ
ʹÓÃEasyswoole ´î½¨¼òµ¥µÄWebsoket·þÎñ
³£¼ûµÄÊý¾ÝͨÐÅ·½Ê½ÓÐÄÄЩ£¿
Openssl 1024bit RSAËã·¨---¹«Ë½Ô¿»ñÈ¡ºÍ´¦
HTTPSЭÒéµÄÃÜÔ¿½»»»Á÷³Ì
¡¶Ð¡°×WEB°²È«ÈëÃÅ¡·03. ©¶´Æª
HttpRunner4.x °²×°ÓëʹÓÃ
2021-07-04
ÊÖдRPCѧϰ±Ê¼Ç
K8S¸ß¿ÉÓð汾²¿Êð
mySQL¼ÆËãIPµØÖ··¶Î§
ÉÏһƪÎÄÕ      ÏÂһƪÎÄÕ      ²é¿´ËùÓÐÎÄÕÂ
¼Ó:2021-11-29 16:38:29  ¸ü:2021-11-29 16:40:31 
 
¿ª·¢: C++֪ʶ¿â Java֪ʶ¿â JavaScript Python PHP֪ʶ¿â È˹¤ÖÇÄÜ Çø¿éÁ´ ´óÊý¾Ý Òƶ¯¿ª·¢ ǶÈëʽ ¿ª·¢¹¤¾ß Êý¾Ý½á¹¹ÓëËã·¨ ¿ª·¢²âÊÔ ÓÎÏ·¿ª·¢ ÍøÂçЭÒé ϵͳÔËά
½Ì³Ì: HTML½Ì³Ì CSS½Ì³Ì JavaScript½Ì³Ì GoÓïÑÔ½Ì³Ì JQuery½Ì³Ì VUE½Ì³Ì VUE3½Ì³Ì Bootstrap½Ì³Ì SQLÊý¾Ý¿â½Ì³Ì CÓïÑÔ½Ì³Ì C++½Ì³Ì Java½Ì³Ì Python½Ì³Ì Python3½Ì³Ì C#½Ì³Ì
ÊýÂë: µçÄÔ ±Ê¼Ç±¾ ÏÔ¿¨ ÏÔʾÆ÷ ¹Ì̬ӲÅÌ Ó²ÅÌ ¶ú»ú ÊÖ»ú iphone vivo oppo СÃ× »ªÎª µ¥·´ ×°»ú ͼÀ­¶¡

360ͼÊé¹Ý ¹ºÎï Èý·á¿Æ¼¼ ÔĶÁÍø ÈÕÀú ÍòÄêÀú 2024Äê11ÈÕÀú -2024/11/26 8:38:28-

ͼƬ×Ô¶¯²¥·ÅÆ÷
¡ýͼƬ×Ô¶¯²¥·ÅÆ÷¡ý
TxTС˵ÔĶÁÆ÷
¡ýÓïÒôÔĶÁ,С˵ÏÂÔØ,¹ÅµäÎÄѧ¡ý
Ò»¼üÇå³ýÀ¬»ø
¡ýÇáÇáÒ»µã,Çå³ýϵͳÀ¬»ø¡ý
ͼƬÅúÁ¿ÏÂÔØÆ÷
¡ýÅúÁ¿ÏÂÔØͼƬ,ÃÀŮͼ¿â¡ý
  ÍøÕ¾ÁªÏµ: qq:121756557 email:121756557@qq.com  ITÊýÂë