Omron CJ1W-ETN21 Protocol Overview, Differences between TCP and UDP, Opening TCP Sockets

Models: CJ1W-ETN21

1 242
Download 242 pages 30.9 Kb
Page 124
Image 124

Protocol Overview

Section 6-2

6-2 Protocol Overview

6-2-1 Differences between TCP and UDP

There are differences in the socket services between TCP and UDP.

TCP Communications

The following procedure is followed each time data is transmitted to ensure that the data arrives normally at the remote node:

1,2,3... 1. The remote node returns ACK when data is received normally.

2.The local node sends the next data after it receives ACK, or it resends the same data if ACK is not returned within the specified time.

Send request made.

Local node

Transmitted data

ACK (acknowledge)

Resent data

when ACK is not returned

Receive request made.

Remote node

With the TCP protocol, the remote IP address and remote TCP port number are specified when an open request is made for a socket. When a send request is made, the number of bytes to send and the send data are specified. When a receive request is made, the number of bytes to receive is specified.

With the TCP protocol, communications with another remote device are not possible until the socket that was opened has been closed.

UDP Communications

Data is simply sent to the remote node. Unlike TCP, the reception of data is not checked and data is not resent. To increase communication reliability, data resends must be programmed by the user in user application.

Send request made.

Transmitted data

ACK (acknowledge: only when processed by application)

Receive request made.

Local node

Remote node

With the UDP protocol, the remote IP address and remote UDP port number are not specified when an open request is made for a socket. When a send request is made, the remote IP address, the remote UDP port number, the number of bytes to send, and the send data are specified. When a receive request is made, the number of bytes to receive is specified. (The response data shows from which IP address and UDP port number the received data was sent.)

With the UDP protocol, communications with another remote device are possible even if the socket that was opened is not closed.

6-2-2 Opening TCP Sockets

To achieve highly reliable data communications, TCP establishes a virtual communications circuit between the two nodes before starting data transmissions. The virtual communications circuit is known as a “connection.”

100

Page 124
Image 124
Omron CJ1W-ETN21 Protocol Overview, Differences between TCP and UDP, Opening TCP Sockets, TCP Communications