Purpose

Creates a TCP/IP connection to a DoIP entity identified by its IP address.

Format

long ndDoIPConnect(
       TD1 *diagRef,
       char address[],
       unsigned short SourceAddress,
       unsigned short TargetAddress);

Input

diagRef

Specifies the handle for the diagnostic session, obtained from ndOpenDiagnosticOnIPStack and passed to subsequent diagnostic functions. Normally, it is not necessary to manually manipulate the elements of this struct.

address

The IP address of the DoIP entity to connect to (zero-terminated string in a.b.c.d notation).

SourceAddress

The DoIP source address of the tester that starts the communication. You can set this input to 0 if you are activating a route through ndDoIPActivateRouting.
Note If you use ndDoIPActivateRouting at a later point to activate a route, then you must specify the source address of the tester using that function.

TargetAddress

The DoIP target address of the device under test that should be connected to. When you connect directly to the device under test without using a DoIP gateway, you can set this input to 0 if you are activating a route through ndDoIPActivateRouting. If you are connecting to the device under test through a DoIP gateway, you must specify the target address of the device under test using this input. Output

Return Value

The return value indicates the function call status as a signed 32-bit integer. Zero means the function executed successfully. A negative value specifies an error, which means the function did not perform the expected behavior. A positive value specifies a warning, which means the function performed as expected, but a condition arose that may require attention.

Use the ndStatusToString function to obtain a descriptive string for the return value.

Description

ndDoIPConnect creates a unique TCP/IP data connection to a certain DoIP entity identified by its IP address. The IP address might be retrieved from ndDoIPGetEntities. The TCP/IP data connection is needed to exchange diagnostic service requests.

When you connect directly to the device under test without using a DoIP gateway, you can either specify the Source Address and Target Address or leave them blank if a route is activated later using ndDoIPActivateRouting. However, if you connect to the device under test through a DoIP gateway, you must specify the Target Address of the device under test in this function.