书
Copyright©2012–2022,成都亿佰特电子科技有限公司
9
4.1.1. SOCKET
ECAN-E01S can establish two sockets, namely Socket A1 and Socket B1. Among them, both channels support all
types of TCP Client, TCP Server, UDP Client, and UDP Server.
Two Sockets run at the same time. It can be connected to different networks at the same time for data transmission.
TCP Client
(1) TCP Client provides client connections for TCP network services. Actively initiate a connection request to the
server and establish a connection for realizing the interaction between CAN data and server data. According to the
relevant provisions of the TCP protocol, the TCP Client is the difference between connection and disconnection, so
as to ensure the reliable exchange of data. It is usually used for data interaction between devices and servers, and is
the most commonly used network communication method.
(2) When ECAN-E01S tries to connect to the server in TCP Client mode and the local port is 0, it will initiate a
connection with a random port every time.
(3) ECAN-E01S supports short connection function.
(4) Under the same local area network, if ECAN-E01S is set to static IP, please keep the IP of ECAN-E01S and the
gateway in the same network segment, and set the gateway IP correctly, otherwise it will not be able to
communicate normally.
TCP Server
(1) TCP Server is the TCP server. In TCP Server mode, ECAN-E01S listens to the local port, accepts and
establishes a connection for data communication when a connection request is sent. client device.
(2) It is usually used for communication with TCP clients in the local area network. It is suitable for scenarios
where there is no server in the local area network and there are multiple computers or mobile phones requesting
data from the server. Like TCP Client, there is a difference between connection and disconnection to ensure reliable
exchange of data.
(3) When ECAN-E01S is used as TCP Server, up to two-way Socket supports 14-way Client, and the local port
number is a fixed value and cannot be set to 0.
UDP Client
(1) UDP Client is a connectionless transmission protocol that provides transaction-oriented simple and unreliable
information transmission services. There is no connection establishment and disconnection, and data can be sent to
the other party only by specifying IP and port. It is usually used in data transmission scenarios where there is no
requirement for the packet loss rate, the data packets are small and the transmission frequency is fast, and the data
is to be transmitted to the specified IP.
(2) In UDP Client mode, ECAN-E01S will only communicate with the target port of the target IP. If the data does
not come from this channel, the data will not be received by ECAN-E01S.
(3) In UDP Client mode, if the target address is set to 255.255.255.255, it can achieve the effect of UDP broadcast
on the entire network segment, and can also receive broadcast data. The ECAN-E01S module supports broadcast
within the network segment, such as xxx.xxx .xxx.255 broadcast method.