Which layer does serial communication belong to?
The correct answer is that serial communication includes three functions: physical layer (physical link transmission, serial line), data link layer (framing, start bit, data bit, check bit, end bit), and application layer (the packaging of application data is made by serial programming itself).
The relationship between serial port and Ethernet: There are two communication modes, and the implementation principles and application scenarios are different.
Serial port to Ethernet port
Serial to Ethernet is not a simple change of transmission media, but a protocol conversion from serial to TCP/IP. The key technologies include: the working mode of TCP/IP, serial port framing technology, 9-bit technology.
Generally speaking, serial port is UART, which actually only defines the specification of data link layer, that is, start bit, data bit and stop bit. But in different physical layers, it can be divided into TTL serial port, RS232 serial port, RS485 serial port and so on.
Because the serial port protocol itself does not have a network layer and a transport layer, the serial port is converted to an Ethernet port, which actually takes the data of the serial port as the application layer data of TCP/IP and is encapsulated and transmitted by TCP/IP. The application layer data of TCP/IP is the real valid data that TCP/IP wants to transmit. For example, what the user receives and sends through the recv () and send () functions of the socket is actually application layer data. In this way, users can use recv () and send () functions to send and receive serial data through the serial port to TCP/IP.
Is the to Ethernet converter all serial ports?
The interfaces of the serial to Ethernet converter are not all serial ports. The serial to Ethernet converter is also known as a serial to Ethernet converter and a serial device server.It is a terminal server that transmits data through the serial port of the TCP/IP server. However, all these names are the same type of equipment. Basically, the serial RS232, RS485 or RS422 interface is linked to the serial port of the serial to Ethernet converter to transmit data to the Ethernet packet.At the same time, the data packet can be transmitted back to the RS232, RS485 or RS422 serial port to realize two-way transparent transmission of data.The serial to Ethernet converter has its own actual IP address, which is why it is sometimes called a server.