doip-server

Example illustrating the “discover” mechanism.

Build the example

$ cmake . -Bbuild
$ cd build
$ make -j
$ cd examples/discover

Start the server

$ ./DoIPServer
# Send 3 vehicle announcements with 500ms interval
...
[13:18:03.469] [server] [info] TX V03|VehicleIdentificationResponse (0x0004)|L33| Payload: 57.56.57.5A.5A.5A.31.4A.5A.33.57.33.38.36.37.35.32.00.28.00.00.00.65.43.21.00.00.00.12.34.56.00.00
[13:18:03.969] [server] [info] TX V03|VehicleIdentificationResponse (0x0004)|L33| Payload: 57.56.57.5A.5A.5A.31.4A.5A.33.57.33.38.36.37.35.32.00.28.00.00.00.65.43.21.00.00.00.12.34.56.00.00
[13:18:04.469] [server] [info] TX V03|VehicleIdentificationResponse (0x0004)|L33| Payload: 57.56.57.5A.5A.5A.31.4A.5A.33.57.33.38.36.37.35.32.00.28.00.00.00.65.43.21.00.00.00.12.34.56.00.00

Run the client

The client (please note the --loopback argument) then tries to discover the DOIP server - either by receiving an announcement or sending actively a vehicle

$ python3 discover-client.py --loopback
...
No announcement received, sending identification request...
Sending vehicle identification request...
Request sent to 127.0.0.1:13400
Received response from 127.0.0.1:13400
  VIN: WVWZZZ1JZ3W386752
  Logical Address: 0x0028
  EID: 000000654321
  GID: 000000123456
  Further Action: 0x00
==================================================
Vehicle discovered successfully!
==================================================
...

Then the client connects to the TCP socket using the IP address of the server response:

Connecting to 127.0.0.1:13400...
TCP connection established

Now the client sends a routing activation request…

Sending routing activation request...
  Response Code: 0x10
  Tester Address: 0x0E80
  Entity Address: 0x0028
  Status: Successfully activated

… and finally reads the VIN via UDS RDBI

Sending UDS RDBI request for DID 0xF190...
  Source: 0x0028, Target: 0x0E80
  UDS Response: 62f1905756575a5a5a314a5a3457303132333435
  Service: Positive Response (0x62)
  DID: 0xF190
  Data: 5756575a5a5a314a5a3457303132333435
  Data (ASCII): WVWZZZ1JZ4W012345