sockConnection (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


This function block returns the current status of a connection initiated by using either the sockConnect() or sockListen() function.

 

 

Input:                

id : SINT

ID of the connection.

 

Output:

Changed : BOOL

Connection info has changed.

 

Connected : BOOL

True if connected, false if disconnected.

 

localport : DINT

Local port number.

 

remoteip : DINT

IP address of peer.

 

remoteport : DINT

Port number of peer.

 

iface : SINT

The network interface used by the connection. 0 = Not Available, 1 = Mobile network, 2 = LAN network, etc. (See Network)

 

Declaration:

FUNCTION_BLOCK sockConnection;
VAR_INPUT
  id         : SINT; // ID of the connection.
END_VAR;
VAR_OUTPUT
  Changed     : BOOL; // New connection info
  Connected   : BOOL; // true if connected, false if disconnected
  localPort   : DINT; // Local portnumber
  remoteIP   : DINT; // IP address of peer
  remotePort : DINT; // Portnumber on peer
  iface       : SINT; // Interface used by the connection
END_VAR;

 

 


Example:

 

Please see the "Examples - Socket Communication"