Step
|
Action
|
---|---|
1
|
Create a socket using the FCT_SOCKET function
|
2
|
Associate the created socket with an address (Port number and IP address) using the FCT_BIND function.
|
3
|
Set up the socket to accept connections using the FCT_LISTEN function.
Note: the PLC acts as TCP server, the initial socket listens, and receives client socket connections.
|
4
|
Apply the FCT_ACCEPT function to this socket to create a new socket which will establish the connection.
Note: this new socket is then connected to the client socket, and its number is returned by the FCT_ACCEPT function. The initial socket is then freed for other clients which wish to connect to the server.
|
Step
|
Action
|
---|---|
1
|
Create a socket using the FCT_SOCKET function block. The block returns a socket number which can then be used in the subsequent function blocks.
|
2
|
Use FCT_CONNECT to make a connection to another Ethernet device by specifying its IP address and the particular port that you are going to communicate on.
|