C#实现TFTP客户端

news2024/11/17 10:51:41

1、文件结构
在这里插入图片描述
2、TftpConfig.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TftpTest
{
    public class TftpConfig
    {
    }
    /// <summary>
    /// 模式
    /// </summary>
    public enum Modes
    {
        NETASCII = 0,   //ASCII
        OCTET = 1       //二进制
    }
    /// <summary>
    /// 操作码
    /// </summary>
    public enum OpCodes
    {
        RRQ = 1,    // 读请求
        WRQ = 2,    // 写请求
        DATA = 3,   // 数据
        ACK = 4,    // Acknowledge
        ERROR = 5,  // 错误
        OACK = 6    // Option Acknowledge
    }
    public enum TransferType
    {
        Get,
        Put
    }
    public struct TransferOptions
    {
        private TransferType _action;

        public TransferType Action
        {
            get { return _action; }
            set { _action = value; }
        }

        private string _localFilename;

        public string LocalFilename
        {
            get { return _localFilename; }
            set { _localFilename = value; }
        }

        private string _remoteFilename;

        public string RemoteFilename
        {
            get { return _remoteFilename; }
            set { _remoteFilename = value; }
        }

        private string _host;

        public string Host
        {
            get { return _host; }
            set { _host = value; }
        }
    }
}

3、ErrorPacket.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TftpTest
{
    public class ErrorPacket
    {
        short _code;

        public short Code
        {
            get { return _code; }
            set { _code = value; }
        }

        string _message;

        public string Message
        {
            get { return _message; }
            set { _message = value; }
        }

        public ErrorPacket(short Code, string Message)
        {
            Code = _code;
            Message = _message;
        }
    }
}

4、PacketBuilder.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TftpTest
{
    public class PacketBuilder
    {
        public byte[] Request(OpCodes OpCode, string RemoteFileName,
            Modes Mode, int BlockSize, long TransferSize, int Timeout)
        {
            // Request packet structure
            // -----------------------------------------------------------------------------
            // |OpCode|FileName|0|Mode|0|BlkSize|0|BSVal|0|TSize|0|TSVal|0|Timeout|0|TVal|0|
            // -----------------------------------------------------------------------------
            int len;

            string packetStr = "";
            string mode = Mode.ToString().ToLower();
            string blockSize = BlockSize.ToString();
            string nullChar = "\0";

            byte[] packet;

            // Create packet as a string
            switch (OpCode)
            {
                case OpCodes.RRQ:
                    packetStr = nullChar + (char)1;
                    break;
                case OpCodes.WRQ:
                    packetStr = nullChar + (char)2;
                    break;
            }

            packetStr += RemoteFileName + nullChar + mode + nullChar + "blksize" +
                nullChar + BlockSize.ToString() + nullChar + "tsize" + nullChar +
                TransferSize.ToString() + nullChar + "timeout" + nullChar +
                Timeout.ToString() + nullChar;

            len = packetStr.Length;
            packet = new byte[len];

            // Encode packet as ASCII bytes
            packet = System.Text.Encoding.ASCII.GetBytes(packetStr);
            return packet;
        }

        public byte[] Ack(int Block1, int Block2)
        {
            // ACK packet structure
            // ----------
            // |04|Block|
            // ----------
            byte[] packet = new byte[4];
            packet[0] = 0;
            packet[1] = (byte)OpCodes.ACK;
            packet[2] = (byte)Block1;
            packet[3] = (byte)Block2;
            return packet;
        }

        public byte[] Data(byte[] SendData, int Block1, int Block2)
        {
            // DATA packet structure
            // ----------
            // |03|Block|
            // ----------
            byte[] packet = new byte[SendData.Length + 4];
            //packet[0] = 0;
            packet[1] = (byte)OpCodes.DATA;
            packet[2] = (byte)Block1;
            packet[3] = (byte)Block2;
            for (int h = 4; h < SendData.Length + 4; h++)
            {
                packet[h] = SendData[h - 4];
            }
            return packet;
        }

        public int[] IncrementBock(byte[] ReceivedData, int[] Block)
        {
            if (ReceivedData[3] == 255)
            {
                if (ReceivedData[2] < 255)
                {
                    Block[0] = (int)ReceivedData[2] + 1; Block[1] = 0;
                }
                else
                {
                    Block[0] = 0; Block[1] = 0;
                }
            }
            else
            {
                Block[1] = (int)ReceivedData[3] + 1;
            }
            return Block;
        }
    }
}

5、PacketReader.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TftpTest
{
    public class PacketReader
    {
        public OpCodes ReadOpCode(byte[] ReceivedData)
        {
            return (OpCodes)ReceivedData[1];
        }

        public int ReadTransferSize(byte[] ReceivedData)
        {
            int h, tSize = 0;
            string searchStr, decPacket = Encoding.ASCII.GetString(ReceivedData);
            char[] splitChar = { '\0' };
            string[] splitPacket = decPacket.Split(splitChar);

            for (h = 0; h < splitPacket.Length - 1; h++)
            {
                searchStr = splitPacket[h].ToLower();
                if (searchStr == "tsize")
                {
                    tSize = int.Parse(splitPacket[h + 1]);
                }
            }
            return tSize;
        }

        public ErrorPacket ReadError(byte[] ReceivedData)
        {
            string codeStr = ReceivedData[2].ToString() + ReceivedData[3].ToString();

            short code = short.Parse(codeStr);
            string message = "";

            for (int h = 4; h < ReceivedData.Length; h++)
            {
                if (ReceivedData[h] == 0)
                    break;

                message += (char)ReceivedData[h];
            }

            return new ErrorPacket(code, message);
        }

        public bool CompareBlocks(byte[] SentData, byte[] ReceivedData)
        {
            if (ReceivedData[2] == SentData[2] &&
                ReceivedData[3] == SentData[3])
                return true;

            return false;
        }
    }
}

6、TftpClient.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace TftpTest
{
    public class TftpClient
    {
        // 委托
        public delegate void ConnectedHandler();
        public delegate void TransferringHandler(long BytesTransferred, long BytesTotal);
        public delegate void TransferFailedHandler(short ErrorCode, string ErrorMessage);
        public delegate void TransferFinishedHandler();
        public delegate void DisconnectedHandler();

        // 事件
        public event ConnectedHandler Connected;
        public event TransferringHandler Transferring;
        public event TransferFailedHandler TransferFailed;
        public event TransferFinishedHandler TransferFinished;
        public event DisconnectedHandler Disconnected;

        private string _host;
        [Description("主机")]
        public string Host
        {
            get { return _host; }
            set { _host = value; }
        }

        private Modes _mode = Modes.OCTET;
        [Description("模式")]
        public Modes Mode
        {
            get { return _mode; }
            set { _mode = value; }
        }

        private int _blockSIze = 512;
        [Description("块大小")]
        public int BlockSize
        {
            get { return _blockSIze; }
            set { _blockSIze = value; }
        }

        private int _timeout = 10;
        [Description("溢出时间")]
        public int Timeout
        {
            get { return _timeout; }
            set { _timeout = value; }
        }

        PacketReader _packetReader = new PacketReader();

        PacketBuilder _packetBuilder = new PacketBuilder();

        public bool Get(string localFile, string RemoteFile, string Host)
        {
            return Get(localFile, RemoteFile, Host, Mode, BlockSize, Timeout);
        }

        public bool Put(string localFile, string RemoteFile, string Host)
        {
            return Put(localFile, RemoteFile, Host, Mode, BlockSize, Timeout);
        }

        public bool Get(string LocalFile, string RemoteFile, string Host,
            Modes Mode, int BlockSize, int Timeout)
        {
            int recvLen, remoteFileSize = 0, buffer = BlockSize + 4;
            long bytesReceived = 0;

            BinaryWriter BWriter = new BinaryWriter(File.Open(LocalFile, FileMode.Create));

            OpCodes opCode = new OpCodes();

            IPHostEntry hInfo = Dns.GetHostEntry(Host);
            IPAddress address = hInfo.AddressList[0];
            IPEndPoint remoteEP = new IPEndPoint(address, 69);
            EndPoint localEP = (remoteEP);
            Socket UDPSock = new Socket
                (remoteEP.AddressFamily, SocketType.Dgram, ProtocolType.Udp);

            // Create initial request and buffer for response
            byte[] sendData = _packetBuilder.Request(OpCodes.RRQ,
                RemoteFile, Mode, BlockSize, 0, Timeout);
            byte[] recvData = new byte[BlockSize + 4];

            UDPSock.ReceiveTimeout = Timeout * 1000;

            // Send request and wait for response
            UDPSock.SendTo(sendData, remoteEP);
            recvLen = UDPSock.ReceiveFrom(recvData, ref localEP);

            // Get TID
            remoteEP.Port = ((IPEndPoint)localEP).Port;

            // Invoke connected event
            Connected.Invoke();

            while (true)
            {
                // Read opcode
                opCode = _packetReader.ReadOpCode(recvData);

                // DATA packet
                if (opCode == OpCodes.DATA)
                {
                    bytesReceived += recvLen - 4;



                    // Invoke Transferring Event
                    Transferring.Invoke(bytesReceived, remoteFileSize);

                    for (int h = 4; h < recvLen; h++)
                    {
                        BWriter.Write(recvData[h]);
                    }

                    sendData = _packetBuilder.Ack(recvData[2], recvData[3]);

                    // Check if this packet is the last
                    if (recvLen < buffer)
                    {
                        // Send final ACK
                        UDPSock.SendTo(sendData, remoteEP);

                        // Invoked TransferFinished Event
                        TransferFinished.Invoke();

                        break;
                    }
                }

                // OACK packet
                else if (opCode == OpCodes.OACK)
                {
                    remoteFileSize = _packetReader.ReadTransferSize(recvData);
                    sendData = _packetBuilder.Ack(0, 0);
                }

                // ERROR packet
                else if (opCode == OpCodes.ERROR)
                {
                    ErrorPacket transferError = _packetReader.ReadError(recvData);
                    TransferFailed.Invoke(transferError.Code, transferError.Message);

                    break;
                }

                // Send next packet
                UDPSock.SendTo(sendData, remoteEP);
                recvLen = UDPSock.ReceiveFrom(recvData, ref localEP);
                remoteEP.Port = ((IPEndPoint)localEP).Port;
            }

            BWriter.Close();
            UDPSock.Close();

            // Invoke Disconnected Event
            Disconnected.Invoke();
            return true;
        }

        public bool Put(string LocalFile, string RemoteFile, string Host,
            Modes Mode, int BlockSize, int Timeout)
        {
            int[] block = new int[2];
            int bufferSize = BlockSize;
            long fileSize, bytesSent = 0;

            BinaryReader BReader = new BinaryReader(File.Open(LocalFile, FileMode.Open));
            FileInfo sendFile = new FileInfo(LocalFile);

            OpCodes opCode = new OpCodes();

            IPHostEntry hostInfo = Dns.GetHostEntry(Host);
            IPAddress address = hostInfo.AddressList[0];
            IPEndPoint remoteEP = new IPEndPoint(address, 69);
            EndPoint localEP = (remoteEP);
            Socket UDPSock = new Socket
                (remoteEP.AddressFamily, SocketType.Dgram, ProtocolType.Udp);

            // Retrieve filesize for tsize option
            fileSize = sendFile.Length;

            // Create initial request and buffer for response
            byte[] sendData = _packetBuilder.Request(OpCodes.WRQ,
                RemoteFile, Mode, BlockSize, fileSize, Timeout);
            byte[] recvData = new byte[bufferSize];

            UDPSock.ReceiveTimeout = Timeout * 1000;

            // Send request and wait for response
            UDPSock.SendTo(sendData, remoteEP);
            UDPSock.ReceiveFrom(recvData, ref localEP);

            //Get TID
            remoteEP.Port = ((IPEndPoint)localEP).Port;

            // Invoke Connected Event
            Connected.Invoke();

            while (true)
            {
                // Read opcode
                opCode = _packetReader.ReadOpCode(recvData);

                // ACK packet
                if (opCode == OpCodes.ACK)
                {
                    block = _packetBuilder.IncrementBock(recvData, block);

                    sendData = BReader.ReadBytes(bufferSize);
                    bytesSent += sendData.Length;

                    // Invoke Transferring Event
                    Transferring.Invoke(bytesSent, fileSize);

                    sendData = _packetBuilder.Data(sendData, block[0], block[1]);

                    // Check if this packet is the last
                    if (sendData.Length < bufferSize + 4)
                    {
                        // Send final data packet and wait for ack
                        while (true)
                        {
                            UDPSock.SendTo(sendData, remoteEP);
                            UDPSock.ReceiveFrom(recvData, ref localEP);
                            remoteEP.Port = ((IPEndPoint)localEP).Port;

                            // Check the blocks and break free if equal
                            if (_packetReader.CompareBlocks(sendData, recvData))
                                break;
                        }

                        // Invoke TransferFinished Event
                        TransferFinished.Invoke();
                        break;
                    }
                }

                // OACK packet
                else if (opCode == OpCodes.OACK)
                {
                    sendData = BReader.ReadBytes(bufferSize);
                    sendData = _packetBuilder.Data(sendData, 0, 1);
                    bytesSent += sendData.Length - 4;

                    // Invoke Transferring Event
                    Transferring.Invoke(bytesSent, fileSize);

                    if (fileSize == 0)
                    {
                        // Invoke TransferFinished Event
                        TransferFinished.Invoke();
                        break;
                    }
                    else
                    {

                        // Check if this packet is the last
                        if (sendData.Length < bufferSize + 4)
                        {
                            // Send final data packet and wait for ack
                            while (true)
                            {
                                UDPSock.SendTo(sendData, remoteEP);
                                UDPSock.ReceiveFrom(recvData, ref localEP);
                                remoteEP.Port = ((IPEndPoint)localEP).Port;

                                // Check the blocks and break free if equal
                                if (_packetReader.CompareBlocks(sendData, recvData))
                                    break;
                            }
                            // Invoke TransferFinished Event
                            TransferFinished.Invoke();
                            break;
                        }
                    }
                }
                else if (opCode == OpCodes.ERROR)
                {
                    ErrorPacket transferError = _packetReader.ReadError(recvData);
                    TransferFailed.Invoke(transferError.Code, transferError.Message);
                    break;
                }

                // Send next packet
                UDPSock.SendTo(sendData, remoteEP);
                UDPSock.ReceiveFrom(recvData, ref localEP);
                remoteEP.Port = ((IPEndPoint)localEP).Port;
            }
            BReader.Close();
            UDPSock.Close();

            // Invoke Disconnected Event
            Disconnected.Invoke();

            return true;
        }
    }
}

7、MainForm.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace TftpTest
{
    public partial class MainForm : Form
    {
        private TftpClient tftpClient = new TftpClient();
        private delegate void ProgressBarDelegate(int Maximum, int Value);
        private delegate void TransferButtonDelegate(bool Enabled);

        public MainForm()
        {
            InitializeComponent();
            tftpClient.Connected += new TftpClient.ConnectedHandler(TftpClient_Connected);
            tftpClient.Transferring += new TftpClient.TransferringHandler(TftpClient_Transferring);
            tftpClient.TransferFailed += new TftpClient.TransferFailedHandler(TftpClient_TransferFailed);
            tftpClient.TransferFinished += new TftpClient.TransferFinishedHandler(TftpClient_TransferFinished);
            tftpClient.Disconnected += new TftpClient.DisconnectedHandler(TftpClient_Disconnected);
        }

        private void TftpClient_Connected()
        {

            TransferButtonDelegate tBtnDel = new TransferButtonDelegate(TransferBtnDelegateFunction);
            btnTest.Invoke(tBtnDel, false);

            Console.WriteLine("Connected");
        }

        private void TransferBtnDelegateFunction(bool Enabled)
        {
            lock (btnTest)
            {
                btnTest.Enabled = Enabled;
            }
        }

        private void TftpClient_Transferring(long BytesTransferred, long BytesTotal)
        {
            if (BytesTotal != 0)
            {
                ProgressBarDelegate progressBarDel = new ProgressBarDelegate(ProgressBarDelegateFunction);
                progressBarTftp.Invoke(progressBarDel,
                    new object[2] { (int)(BytesTotal / 10), (int)(BytesTransferred / 10) });

                Console.Write("{0}/{1} Bytes Transferred\r", BytesTransferred, BytesTotal);
            }
            else
                Console.Write(".");
        }

        private void ProgressBarDelegateFunction(int Maximum, int Value)
        {
            lock (progressBarTftp)
            {
                try
                {

                    progressBarTftp.Maximum = Maximum;
                    progressBarTftp.Value = Value;
                }
                catch (Exception e) { Console.WriteLine(e.ToString()); }
            }
        }

        private void TftpClient_TransferFailed(short ErrorCode, string ErrorMessage)
        {
            Console.WriteLine("Error {0}: {1}", ErrorCode, ErrorMessage);
        }

        private void TftpClient_TransferFinished()
        {
            ProgressBarDelegate progressBarDel = new ProgressBarDelegate(ProgressBarDelegateFunction);
            progressBarTftp.Invoke(progressBarDel, new object[2] { 0, 0 });

            Console.WriteLine("\nTransfer Finished");

            MessageBox.Show("Transfer Complete", "TFTP Client",
                MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void TftpClient_Disconnected()
        {
            TransferButtonDelegate tBtnDel = new TransferButtonDelegate(TransferBtnDelegateFunction);
            btnTest.Invoke(tBtnDel, true);

            Console.WriteLine("Disconnected\n");
        }

        private void btnTest_Click(object sender, EventArgs e)
        {
            progressBarTftp.Value = 0;

            TransferOptions tOptions = new TransferOptions();
            //tOptions.LocalFilename = "D:\\Project\\QDRP3\\Sw\\QDRP\\QDRP\\bin\\Debug\\Case\\PLBIN.bin";
            tOptions.LocalFilename = "F:\\Test\\PLBIN.bin";
            tOptions.RemoteFilename = "PLBIN.bin";
            tOptions.Host = "10.11.9.62";
            //tOptions.Action = getRadio.Checked == true ? TransferType.Get : TransferType.Put;
            tOptions.Action = TransferType.Get;

            Thread tThread = new Thread((ParameterizedThreadStart)delegate (object ScanOptions)
            {
                TransferOptions options = (TransferOptions)ScanOptions;
                if (options.Action == TransferType.Get)
                    tftpClient.Get(options.LocalFilename,options.RemoteFilename,options.Host);
                else
                    tftpClient.Put(options.LocalFilename, options.RemoteFilename, options.Host);
            });
            tThread.IsBackground = true;
            tThread.Start(tOptions);
        }
    }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1625343.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

前端单元测试的艺术:专业化策略与Vue项目高效实践指南

单元测试是软件开发中的基石&#xff0c;尤其对于前端领域&#xff0c;它为保证代码质量、提升开发效率、强化项目稳定性提供了不可或缺的支持。本文将深入剖析单元测试的核心理念&#xff0c;揭示其在前端开发中的独特价值&#xff0c;并提炼出一套专业且高效的实践策略&#…

闲谈工作边界

在程序员的日常工作中&#xff0c;会遇到很多边界问题。如果这些边界问题不处理好&#xff0c;会面临诸多问题。切不可忽略边界问题&#xff0c;因为这些边界很有可能是日后帮助你摆脱扯皮&#xff0c;避免被甩锅&#xff0c;甚至于好心办坏事。 那么我们来谈一下如何处理边界问…

关于螺栓的注意事项和正确操作方法——SunTorque智能扭矩系统

智能扭矩系统-智能拧紧系统-扭矩自动控制系统-SunTorque 螺栓&#xff0c;作为一种常见的紧固件&#xff0c;广泛应用于各种机械设备和结构中。在日常生活和工作中&#xff0c;我们经常需要接触到螺栓&#xff0c;因此了解螺栓的一些注意事项和正确操作方法对于确保设备的安全…

ASP.NET集成客户关系管理的企业网站的设计与开发

摘 要 企业要在激烈的市场竞争中立于不败之地&#xff0c;就必须找一种全新的管理理念和管理手段&#xff0c;对其内部和外部资源进行有效的整合。新一代ERP产品正在向客户端和供应端延伸&#xff0c;客户端的延伸即是客户关系管理。对于每个企业来说客户管理的完善程度将直接…

2024新版计算机网络视频教程65集完整版(视频+配套资料)

今日学计算机网络&#xff0c;众生皆叹难理解。 却见老师神乎其技&#xff0c;网络通畅如云烟。 协议层次纷繁复杂&#xff0c;ARP、IP、TCP、UDP。 路由器交换机相连&#xff0c;数据包穿梭无限。 网络安全重于泰山&#xff0c;防火墙、加密都来添。 恶意攻击时刻存在&#xf…

平衡二叉树、红黑树、B树、B+树

Tree 1、前言2、平衡二叉树和红黑树3、B树和B树3.1、B树的构建3.2、B树和B树的区别3.3、数据的存储方式 1、前言 本文侧重在理论方面对平衡二叉树、红黑树、B树和B树的各方面性能进行比较。不涉及编程方面的实现。而关于于平衡二叉树在C中的实现&#xff0c;我的上一篇文章平衡…

【openLooKeng-1.10.0集群环境安装部署】

openLooKeng-1.10.0集群环境安装部署 一、摘要二、正文1. 环境说明2. 集群拓扑图3. 安装过程(以root用户安装)3.1 在Coordinator和Worker两个节点都需要安装jdk1.8+3.2 在Coordinator上安装配置openLooKeng3.3 在Worker节点上进行配置openLooKeng3.4 在Coordinator节点上先启…

Oracle Analytics BIEE 操作方法(六)数据格式1:百分比

问题&#xff1a; 有如下公式&#xff0c;将数据显示为按行的百分比。此时数据显示只会有一位小数。想显示两位 解决方案 在分析中找到“高级”标签&#xff0c;将“分析XML”中内容复制出来 替换 将&#xff1a;minDigits“1” maxDigits“1” 替换为&#xff1a;minDigits…

Quarto Dashboards 教程 3:Dashboard Data Display

「写在前面」 学习一个软件最好的方法就是啃它的官方文档。本着自己学习、分享他人的态度&#xff0c;分享官方文档的中文教程。软件可能随时更新&#xff0c;建议配合官方文档一起阅读。推荐先按顺序阅读往期内容&#xff1a; 1.quarto 教程 1&#xff1a;Hello, Quarto 2.qu…

FineBi中创建自定义的图表

FineBi中增加自己的自定义图表组件,比如: 的相关笔记: 1 获取有哪些BI自定义图表组件:http://localhost:8080/webroot/decision/v5/plugin/custom/component/list?_=1713667435473[{"name": "图表DEMO_EK","chartType": "amap_demo&q…

知识付费平台的搭建重点,会用到哪些三方服务?

知识付费平台的搭建重点主要包括以下几个方面&#xff1a; 确定目标用户群体&#xff1a;首先需要明确平台的目标用户是谁&#xff0c;他们有什么样的学习需求和付费习惯。这有助于为平台制定合适的内容策略和推广策略。内容策划与制作&#xff1a;知识付费平台的核心是内容&a…

AOI在SMT生产线的关键作用

在SMT&#xff08;表面贴装技术&#xff09;的生产过程中&#xff0c;AOI&#xff08;自动光学检测&#xff09;技术发挥着不可替代的作用。通过本文&#xff0c;我们将深入探讨AOI在提升SMT生产线效率和产品质量方面的关键优势。 AOI技术在SMT生产线的核心作用 精确检测元件位…

柱形图“变个装”,跟上时尚步伐!

前言 职场中&#xff0c;日报、周报、月报、年度总结&#xff0c;都离不开图表的制作&#xff0c;而柱状图又是最常用的一种&#xff0c;怎样的柱状图&#xff0c;才能让领导更容易阅读&#xff0c;甚至是眼前一亮呢&#xff1f;今天小编就将为大家介绍一下如何借助葡萄城公司…

Nginx基本使用 反向代理与负载均衡

什么是Nginx Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器。 其特点是占有内存少&#xff0c;并发能力强&#xff0c;nginx的并发能力在同类型的网页服务器中表现较好&#xff0c;而且几乎可以做到7*24不间断运行&#xff0c;即使运行数个月也不需要重新启动。 …

JavaEE——spring MVC请求处理

目录 主要目的&#xff1a; 1. Spring web 项目搭建 2. 添加依赖 3. 配置插件 4. 配置设置类 5. 编写controller层类 6. 编写测试的http请求 主要目的&#xff1a; 创建一个spring web项目&#xff1b; 创建控制类&#xff1b; 掌握如何配置MVC&#xff1b; 编写htt…

前端调用DRI后端API出现跨域资源共享(CORS)问题解决办法

目录 1. 引言2. 跨源资源共享和实现方法3. 在Django项目中配置django-cors-headers库Reference 1. 引言 在进行后端API开发时&#xff0c;有时会遇到“跨域资源共享 (CORS) 请求…被阻止“的错误&#xff0c;如图1所示。本文讲解如何在使用DRF&#xff08;Django REST Framewo…

区块链技术与应用学习笔记(12-13节)——北大肖臻课程

目录 12.BTC-匿名性 一、什么是匿名&#xff1f; 1&#xff0c;有可能破坏比特币匿名性的两个方面 2&#xff0c;如何提高匿名性 一个比特币用户能采用什么样的方法尽量提高个人的匿名性? 分解&#xff1a; 1、网络层怎么提高匿名性? 2、应用层怎么提高匿名性? 零知…

微信小程序开发:1.微信开发者工具应用

app.json文件作用 pages 记录所有的页面路经 window 全局定义小程序样式 style v2代表使用全新样式 sitemapLocation 指名sitemap.json存放路经 Project.config.json 是项目配置文件&#xff0c;用来记录我们对小程序个性化配置 setting保存了编辑相关配置projectna…

mac 教程 终端如何拆墙

一直觉得自己写的不是技术&#xff0c;而是情怀&#xff0c;一个个的教程是自己这一路走来的痕迹。靠专业技能的成功是最具可复制性的&#xff0c;希望我的这条路能让你们少走弯路&#xff0c;希望我能帮你们抹去知识的蒙尘&#xff0c;希望我能帮你们理清知识的脉络&#xff0…

FFmpeg下载教程(Windows版)

文章目录 下载地址步骤 下载地址 https://ffmpeg.org/download.html 步骤