FUNCTION_BLOCK PUBLIC FINAL TCP_Client EXTENDS LCon IMPLEMENTS IClient
Implements a TCP Client.
To connect to a TCP Server at the endpoint defined with itfIPAddress and uiPort the input xEnable should set to TRUE. While setup the connection xBusy is TRUE but xActive is FALSE. After the connection is established xActive and xBusy is TRUE and the itfConnection output is valid. After closing the connection from the server side xActive becomes FALSE itfConnection become invalid and xDone becomes TRUE.
itfConnection can be used as input itfConnection for function blocks TCP_Write, TCP_Writer, TCP_Read and TCP_Reader.
InOut:
|
Scope
|
Name
|
Type
|
Initial
|
Comment
|
Inherited from
|
Input
|
xEnable
|
BOOL
|
|
TRUE: Activates the defined operation FALSE: Aborts/resets the defined operation
|
LCon
|
Output
|
xDone
|
BOOL
|
|
Ready condition reached
|
LCon
|
xBusy
|
BOOL
|
|
TRUE: Operation is running
|
LCon
|
xError
|
BOOL
|
|
TRUE: Error condition reached
|
LCon
|
eErrorID
|
ERROR
|
|
|
LCon
|
Input
|
itfAsyncProperty
|
IAsyncProperty
|
|
|
|
itfTLSContext
|
ITLSContext
|
|
|
|
itfTSNContext
|
ITSNContext
|
|
|
|
udiTimeOut
|
UDINT
|
0
|
Defines the time (µs) after which the connection setup aborts with active xError.
|
|
itfIPAddress
|
IIPAddress
|
|
The related server address
(With ResolveHostname, the conversion from a hostname to an ip address is possible)
|
|
uiPort
|
UINT
|
|
The related server port
|
|
Output
|
xActive
|
BOOL
|
|
TRUE if a Connection is established
|
|
itfConnection
|
IConnection
|
|
The established connection to the related server
Valid, as long xActive = TRUE
|
|
|