With the development of embedded systems, it has become a research hotspot to implement network connections in embedded systems. The insufficiency of the performance of widely used inexpensive 8/16-bit embedded processors and the complexity of network protocols constitute a sharp contradiction. The core of embedded Internet technology is to implement the TCP/IP protocol suite in the embedded system. The mechanism of the TCP protocol is relatively complex, and the 8/16-bit embedded processor requires high storage capacity and computing power and must be simplified. This paper presents a simplified TCP protocol for 8/16-bit low-speed processors. The analysis of its performance found that the use of small data packets in the embedded network, resulting in low network bandwidth utilization and easy to cause network congestion. Therefore, the introduction of Nagle's algorithm in the simplified TCP protocol greatly reduces the number of small packets sent in the embedded network, improves the throughput, and reduces the required bandwidth. Data transmission of the TCP protocol is divided into three phases: Establishing a connection, transmitting data, and disconnecting a connection can be achieved using a state machine. It is very difficult for an 8/16-bit embedded microcontroller to fully implement such a complex state machine. Simplifying the implementation of TCP in embedded systems has been a relevant research. This paper further introduces Nagle's algorithm and carries out network simulation. The experimental results are given. There are two ways for TCP to establish a connection: active open and passive open. If you implement a server-side application, you can simplify the active open connection part of the TCP state machine. Similarly, the client application can simplify the passive open connection part of the state machine. There are also two ways to disconnect: active disconnection and passive disconnection. The process of passive disconnection is relatively simple. However, in order to ensure security, you want to actively disconnect. The method of simplifying the realization of active disconnection is to send a Fin datagram. After receiving the confirmation of the Fin datagram, it sends a Reset datagram to complete the active disconnection. Taking a server-side TCP connection as an example, the simplified TCP state machine is shown in Figure 1. Single TCP connection Simplify the TCP protocol on an 8/16-bit microcontroller without the need to implement multiple TCP connections. Only a single TCP connection is required. The embedded system does not send packets. It can remove the sliding window mechanism of the TCP protocol and become a simple acknowledgment mechanism. It only acknowledges a single datagram instead of bulk data. The implementation method is to set the size of the TCP header windows field to 1, so as to ensure that both sides of the TCP protocol use simple confirmation. Since the TCP protocol checksum calculation has more system storage and computational resources, the calculation of the checksum of the received datagram can be omitted, and the calculation of the TCP checksum of the sending datagram can be retained. Based on the above four aspects, a simplified TCP protocol is implemented in the embedded processor, and the program flow is shown in Figure 2. The "corresponding processing of different states" refers to preparing a datagram to be sent according to the received TCP message and sending it to the Ethernet. This simplified TCP protocol performance can be achieved in NS-2 Usually in the embedded environment, the data packets generated by the application layer are very small, often only a few, a dozen, dozens of bytes of data per packet. This creates a problem: the header of the TCP protocol. Too much overhead. Assuming that the data is only one byte, and the TCP packet header is 40 bytes, the utilization of such a datagram for the underlying network is only 1/41, and some bits are needed to take into account the gap between the packets and the network hardware components. The actual network utilization is lower. This common small packet of embedded systems causes a great waste of network bandwidth. In addition to the low network utilization rate, there is another problem that a large number of TCP packets are generated, and gateways and routers are blocked due to these extremely large number of small data packets. Through the above analysis, it is natural to think of using clumping to group a certain number of data packets into one frame. This will not only reduce the header overhead, but also reduce the number of TCP packets, and the amount of code increases little. However, this group package creates a problem in that TCP does not transmit data before the data frame reaches a certain size, and the resulting delay will affect the real-time data transmission. Therefore, it is necessary to study how to avoid this delay. In the early days of the Internet development, due to the popularity of bbs and newsgroups, the Internet was flooded with a large number of small packets generated by telnet. The large number of these packets caused serious blocking of routers and gateways. The situation is similar. JoneNagle proposed an algorithm to deal with this tricky small packet problem, later called the Nagle algorithm. The Nagle algorithm differs from the simple clumping technique in that it uses self clocking, as with slow start, to trigger the transfer of the rest of the data with the arrival of an acknowledgment. Therefore, it does not introduce additional delays, and it can effectively reduce the traffic of small packets on the network. In the case where the data that has been transmitted on a connection has not been acknowledged yet, the sender's application generates subsequent data and sends the data to the output buffer as usual, but this time no subsequent segments are sent. Wait until there is enough data to fill in a segment that reaches the maximum length before sending out the data in the buffer. If an application generates only one octet at a time, TCP will send the original octet immediately, but before the acknowledgment arrives, TCP will store subsequent data in the buffer. Therefore, when the application generates data at a much faster rate than the network (such as transmitting files), subsequent segments will contain a large amount of data, and when the application is slower than the network (such as the user's keyboard), Shorter segments are sent without having to go through a long delay. In the embedded system environment, the embedded TCP protocol will face various situations, such as one or two switches, or the real-time transmission of sensor data. The Nagle algorithm can automatically adapt to the network speed and application layer data traffic. In various situations, because it is a self-timed protocol triggered by an acknowledgment. NS-2 is a discrete event simulator for network research that fully supports the simulation of TCP, routing, and multicast protocols on wired and wireless networks. Since its inception, it has been fully trusted by the academic community and has become the authoritative network simulation testing platform for designing and testing new protocols and algorithms. Figure 3 is the network simulation environment built in this paper: Node 0 uses the embedded TCP protocol proposed in this paper to send data, and Node 1 uses User Text Protocol (UDP) multicast protocol to send large amounts of data for testing the embedded TCP protocol. Performance in the case of network congestion, between node 2 and node 3 is a bottleneck path, simulating the line conditions between the switches. The performance index of the embedded TCP protocol has throughput (throughput), which is the number of bytes sent by the TCP source node per unit time; delay, that is, the amount of time the application layer of the source node sends data to the application layer of the destination node to receive the data. . As a simple confirmation of the TCP protocol, because the window is always 1, the throughput rate (t hroughp ut ) is constant. Because Nagle's algorithm is used, there are no more small packets to generate. The throughput rate is improved, and the increase factor is approximately equal to Divide the maximum Internet packet size by the application layer to generate the packet size. For example, if the data packet generated by the application layer is 10 byte, the throughput rate is increased by 1000/10 = 100 times. As shown in Figure 4, the received data increases linearly with time, which means that the throughput rate is constant. The highest curve is the throughput rate of the simplified TCP protocol using Nagle's algorithm; the lowest curve is the throughput rate of the simplified TCP protocol without Nagle's algorithm in the same environment; the middle curve is the uncomplicated standard TCP protocol, so it can be plotted from As you can see, Nagle's algorithm is significantly better than the other two cases, and it greatly improves the throughput of simplified TCP. Looking again at the latency problem, Nagle's algorithm sends the initial data immediately, and then sends the rest of the data at high throughput. This leads to, first, a greatly increased throughput rate, which makes the data transfer faster. Second, the number of generated data packets decreases, so that the chance of congestion retransmissions also decreases. Figures 5 and 6 show the delay jitter of the standard TCP protocol and the delay jitter of the TCP protocol using the Nagle algorithm. The spike at the beginning of the curve in Figure 6 shows that at the start of the data connection, the Nagle algorithm will immediately send the received small packet, and next will send the large amount of data received into a large packet. The smoothness of the graph in Figure 6 illustrates that the delay jitter is small and suitable for real-time data transmission in embedded systems. Under the same simulation parameters, the standard TCP protocol sent a large number of packets (120), while the simplified TCP protocol using Nagle algorithm sent less than 20 packets. Obviously, the simplified TCP protocol using Nagle's algorithm saves network bandwidth while providing high throughput. The practicality of the network protocol is reflected in the fact that, in a hostile network environment (such as data loss), the connection can be maintained and data transmission can be resumed. It has been analyzed in the foregoing that the possibility of blocking the TCP protocol based on the Nagle algorithm is significantly lower than that of the ordinary TCP protocol because the number of small data packets on the network is greatly reduced and the network bandwidth requirement is reduced. If the network is blocked once, there will be packet loss. The TCP data sender will receive 3 duplicate acknowledgement (ACK) signals. Based on the simplified TCP of Nagle's algorithm, it also performs standard retransmission data work and retransmits lost data packets. Since the send window is always 1, there is no "quick recovery" problem. The simulation results for this protocol are shown in Figure 7: The abscissa is the simulation time and the ordinate is the sequence number of the data packet. The two curves above are Tahoe TCP's data and confirmations, while the lower two curves are based on Nagle's TCP data and confirmations. In the figure, Tahoe TCP received three identical ACK acknowledgement packets at some point after slow start, indicating that the network was blocked, and that the bandwidth used for transmitting the same data Tahoe TCP is much larger than that of Nagle-based simplified TCP. Nagle-based simplified TCP is not blocked. From the above analysis, the simplified TCP based on the Nagle algorithm is reliable in data transmission. Can be widely used in embedded TCP, and is fully compatible with other TCP algorithms, and can significantly improve network performance and reduce network congestion, especially when the application layer data volume is small but the number of packets is large It is a very practical algorithm to greatly improve data throughput and network occupancy. WindowsTM also uses the Nagle algorithm in its Telnet program. The TCP protocol based on Nagle's algorithm has a simple algorithm and excellent performance. The applications that can be used in the broad embedded Internet include: industrial control, smart home, intelligent monitoring, automatic meter reading, and so on. This protocol can be applied to occasions with high real-time requirements. However, Nagle's algorithm is not recommended if the real-time requirements are particularly high and the network bandwidth is plentiful. The simplified TCP protocol based on the Nagle algorithm proposed in this paper greatly eases the computational burden of the microprocessor and the storage space of the system, making the TCP protocol use the Nagle algorithm on ordinary 8/16-bit processors without increasing the code. In this case, the throughput of the protocol is improved, and the bandwidth consumption of the protocol is reduced. In embedded applications, the throughput rate is even higher than that of the unsimplified standard TCP protocol. Its delay jitter is basically constant, which is very suitable for real-time data transmission in embedded systems. It saves network bandwidth by sending a small amount of large packets instead of a large number of small packets. The automatic meter reading scheme based on this algorithm has been field tested on the campus networks of Zhejiang University, Hangzhou Netcom, Ningbo Netcom, Shanghai Cable, and other broadband networks. The test results meet the design requirements. The program has been adopted by many home appliance manufacturers in China and applied to the production of new network energy meters. This network energy meter can easily realize networked automatic collection and copying systems. These systems have been applied in Shanghai, Hangzhou and Ningbo. In the power sector of other places. At the same time, the new energy meter and its technical documents based on this project have been recommended and submitted to the National Electrical Instrument Standardization Technical Committee.
Function description
The
socket is ordinary converter,with two output 5V2A power USB power
supply at the same time,can be very convenient in use electrical
appliances and recharge the equipment at the same time,such as digital
products like Iphone Ipad,MP3,MP4 etc.The charge apply to full range of
international AC output,no-load power consumption less than 0.3W,with
short circuit,overload,over-voltage protection,can be convenient for
your life and save more energy
Timer Control Time Adgustment
1.Press the power switch 1 time,the 1HOUR LED will light on.The Timer into ON mode,USB and control socket output ON .
2.Continuously
press the power switch the LED light on,the Countdown mode and LED
light on will cycle change from 1HR,2HR,4HR,6HR,8HR,10HR.
3.Choose
you need countdown time mode,the mode LED will lighto on,start
countdown until countdown time finish,the control output and USB change
to OFF
4.Then the countdown is start,The Time indicate LED will from high to low auto change until Countdown finish off.
Failure analysis:
1.check whether the power supply connection is good
2.check whether the USB cable is loosen
Warning Note:
1.Use indoor and dry location ONLY
2.The load max does not exceed 15A 3600W
3.This product does not convert voltage please do not miss use DO NOT exceed the maximum loading of 3600 Watts 15A
4.Always have earth connection for safety reason
5.If in doubt please consult with a qualified electrician
USB countdown timer, USB countdown timer socket, USB timer, USB charger timer, USB timer socket NINGBO COWELL ELECTRONICS & TECHNOLOGY CO., LTD , https://www.cowellsocket.com