On 10/14/2010 12:07 PM, Alexander Stein wrote:
> Hello,
> 
> On Thursday 14 October 2010, 12:00:06 Wolfgang Grandegger wrote:
>>>> Yes, it's explained in section 3.2, 4.1.3 and 4.1.4 of:
>>>>
>>>> http://lxr.linux.no/#linux+v2.6.35.7/Documentation/networking/can.txt
>>>
>>> I read those sections several times, but I doubt I get it all correctly.
>>> To my understanding CAN_RAW_LOOPBACK is the option to enable reception
>>> of sent frames on _different_ sockets of the same device. And
>>> CAN_RAW_RECV_OWN_MSGS is the option to enable reception of sent frames
>>> on the _same_ socket of the same device.
>>
>> Sounds good.
>>
>>> If I'm right until here, why do I get my own sent messages on one socket,
>>> if CAN_RAW_LOOPBACK = 1 and CAN_RAW_RECV_OWN_MSGS = 0 is set?
>>
>> You mean you get the message on the *same* socket you use for sending?
> 
> Yes, I write a frame on this socket and after that I read which gets my 
> previously sent frame. I do bind this socket to a specific device, but I 
> doubt 
> this does matter in this case.

Hm.

> Some code example here:
>>     memset(&txFrame, 0, sizeof(txFrame));
>>     memset(&rxFrame, 0, sizeof(rxFrame));
>>     txFrame.can_id = 0x10;
>>     txFrame.can_dlc = 0;
>>     nbytes = write(hCanSock_l, &txFrame, sizeof(struct can_frame));
>>     if (nbytes < 0) {
>>         perror("error sending can frame");
>>         bRet = FALSE;
>>     } else {
>>         nbytes = read(hCanSock_l, &rxFrame, sizeof(struct can_frame));
>>         if (nbytes < 0) {
>>             perror("error reading sent can frame");
>>             bRet = FALSE;
>>         } else {
>>             if (memcmp(&rxFrame, &txFrame, sizeof(struct can_frame)))
>>                 bRet = FALSE;
>>         }
>>     }

Could you please send your test program so we can check.

Thanks,

Wolfgang.

_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to