FCT_ACCEPT: Accepts a Connection Request
(Original Document)
Function Description
The FCT_ACCEPT function is used to accept a connection request received by the specified socket.
This connection request comes from a foreign socket.
Before FCT_ACCEPT is called, a socket must be set up to receive a connection request by issuing the FCT_LISTEN call. The FCT_ACCEPT function:
The new returned socket number is used to read from and write data to the foreign socket. It is not used to accept more connections. The original socket remains open for accepting further connections.
If there are no pending connections in the queue, FCT_ACCEPT returns an error.
The additional parameters EN and ENO may be configured.
Representation in FBD
Representation in LD
Representation in IL
LD Module_Number
FCT_ACCEPT Socket_Number, Clie_Index, Gest_Index, Management_Param, Client_Address
Representation in ST
FCT_ACCEPT(Module_Number, Socket_Number, Clie_Index, Gest_Index, Management_Param, Client_Address);
Description of Parameters
The following table describes the input parameters:
Parameter
Type
Comment
Module_Number
Slot number of network module in rack 0.
  • Low byte is the slot number of network module in rack 0.
  • High byte can be used to extend the number of sockets.
    • 00: Provided for full backward compatibility with applications created on firmware version 3.3 or earlier.
    • 01: Up to 64 sockets can be used (firmware version must be higher than 3.3).
Socket_Number
Socket number
Clie_Index
Index of first word in Client_Address array
Gest_Index
Index of first word in Management_Param array
The following table describes the output parameters:
Parameter
Type
Comment
Client_Address
ARRAY [0... 3] OF INT
Array of 4 words containing the service socket number, the port number and the IP address of the client:
  • Client_Address[0]: connected socket number
  • Client_Address[1]: client port number
  • Client_Address[2]: least significant word of the client IP address
  • Client_Address[3]: most significant word of the client IP address
The following table describes the input/output parameters:
Parameter
Type
Comment
Management_Param
ARRAY [0... 3] OF INT
The operation report can have the following values:
  • 16#00: no error
  • 16#09: the socket number is invalid
  • 16#16: the FCT_LISTEN function must be called before FCT_ACCEPT
  • 16#23: no connection request