IConnection.GetClientAddress (METH)ΒΆ

METHOD GetClientAddress : ERROR

Provides the connection data (IP + port) of a client connected to this connection.

Below is an example of how to handle the itfIPAddress parameter. It is necessary to assign an instance of NBS.IPv4Address to a variable of type NBS.IIPAddress.

 VAR
     eErrorID : NBS.ERROR;
     itfConnection : NBS.IConnection;
     myClientIPAddress : NBS.IPv4Address;
     itfClientIPAddress : NBS.IIPAddress := myClientIPAddress;
     uiPortFrom : UINT;
     myIPFrom : ARRAY[0..3] OF BYTE;
 END_VAR

 eErrorID := itfConnection.GetClientAddress(
     itfIPAddress:=itfClientIPAddress, uiPortFrom=>uiPortFrom,
 );

IF eErrorID = NBS.ERROR.NO_ERROR THEN
    myIPFrom := myClientIPAddress.GetIPasByteArray(eError=>eErrorID);
END_IF
InOut:

Scope

Name

Type

Return

GetClientAddress

ERROR

Inout

itfIPAddress

IIPAddress

Output

uiPort

UINT