Hey, On vr, 05 jul 2019 17:52:16 +0200, Arthur Guyader wrote: > Hello all, > > I looked at the code of can-utils and more precisely jacd.c. > > In the way it is implemented, the deamon's only objective is to change its > address according to the different requests it receives. That is indeed the only thing jacd does. It helps other programs that use the same 64bit NAME so that they don't have to implement the same thing. > More precisely, the socket is blocked until the next received claiming > address request (recvfrom). yes. Since it's the only thing it does, there is no need to use non-blocking calls. > > In a real implementation, do you need two sockets? > - one to receive and write messages > - another dedicated only to the claiming address > Or did you have another solution? The objective is to have multiple programs or sockets open that each implement a little functionality, and that share the same NAME and address. To the outer world howevers, they must cooperate and use the same address at all times. This is not technically enforced, you could combine all logic in one program. In my experience, it's hard to get that one program correct and stable, and it's easier when you divide it in pieces. > > In the documentation, it says: "If another ECU claims the address, the > kernel will mark the NAME-SA expired", how can this be checked? This is implemented in the kernel-part of j1939, which is not yet mainline. That part does interprete address claim traffic. You cannot check that from userspace, other than finding yourself blocked when using that SA. The kernel will enforce the address claiming. > > Do you plan to integrate the management of the claiming address (jacd.c) > into the kernel or leave it to the user? The kernel part of address claiming already exists, but is not mainlined. It enforces correct operation on the bus. The userspace part is jacd, whose only job is to choose an address. kind regards, Kurt