All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] RTCAN: multiple sockets on one device
@ 2006-11-23 12:11 Daniel Schnell
  2006-11-23 15:44 ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Schnell @ 2006-11-23 12:11 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

Hi,
 
If one opens two sockets to one CAN port and wants to use one socket
file descriptor for reading and the other for writing, is it possible to
limit the writing socket to _write only_, so it doesn't receive messages
?
 
Background: if using this kind of approach, both sockets will get a copy
of the received data. So the writing only socket gets a receive buffer
overflow, because it doesn't read the data from the socket. If one could
somehow set this socket to a write only state, the buffer overflow would
probably not happen.
 
Best regards,
 
Daniel.

[-- Attachment #2: Type: text/html, Size: 1655 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-help] RTCAN: multiple sockets on one device
  2006-11-23 12:11 [Xenomai-help] RTCAN: multiple sockets on one device Daniel Schnell
@ 2006-11-23 15:44 ` Jan Kiszka
  2006-11-23 16:29   ` Wolfgang Grandegger
  2006-12-03 15:49   ` Wolfgang Grandegger
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Kiszka @ 2006-11-23 15:44 UTC (permalink / raw)
  To: Daniel Schnell; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

Daniel Schnell wrote:
> Hi,
>  
> If one opens two sockets to one CAN port and wants to use one socket
> file descriptor for reading and the other for writing, is it possible to
> limit the writing socket to _write only_, so it doesn't receive messages
> ?

Option 1: Do not bind the socket, use sendto/sendmsg for transmitting
(send requires binding).

Option 2: Register an impossible filter for the write-only socket. This
is suboptimal ATM. Actually we should allow registering an empty filter
list for this purpose. This has been recently discussed on the socketcan
list, but I'm not aware of any concrete result.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-help] RTCAN: multiple sockets on one device
  2006-11-23 15:44 ` Jan Kiszka
@ 2006-11-23 16:29   ` Wolfgang Grandegger
  2006-12-03 15:49   ` Wolfgang Grandegger
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Grandegger @ 2006-11-23 16:29 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

Jan Kiszka wrote:
> Daniel Schnell wrote:
>> Hi,
>>  
>> If one opens two sockets to one CAN port and wants to use one socket
>> file descriptor for reading and the other for writing, is it possible to
>> limit the writing socket to _write only_, so it doesn't receive messages
>> ?

Note that the messages are aways received and handled by the ISR. If 
nobody is waiting on messages defined by the filter definitions, they 
will be discarded.

> Option 1: Do not bind the socket, use sendto/sendmsg for transmitting
> (send requires binding).

Yes, this will avoid checking one unnecessary filter definition (a bit 
less overhead). But using just one socket would be fine as well ;-).

> Option 2: Register an impossible filter for the write-only socket. This
> is suboptimal ATM. Actually we should allow registering an empty filter
> list for this purpose. This has been recently discussed on the socketcan
> list, but I'm not aware of any concrete result.

Oliver answered and liked the idea, but there is no agreement yet.

Wolfgang.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-help] RTCAN: multiple sockets on one device
  2006-11-23 15:44 ` Jan Kiszka
  2006-11-23 16:29   ` Wolfgang Grandegger
@ 2006-12-03 15:49   ` Wolfgang Grandegger
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Grandegger @ 2006-12-03 15:49 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

Jan Kiszka wrote:
> Daniel Schnell wrote:
>> Hi,
>>  
>> If one opens two sockets to one CAN port and wants to use one socket
>> file descriptor for reading and the other for writing, is it possible to
>> limit the writing socket to _write only_, so it doesn't receive messages
>> ?
> 
> Option 1: Do not bind the socket, use sendto/sendmsg for transmitting
> (send requires binding).
> 
> Option 2: Register an impossible filter for the write-only socket. This
> is suboptimal ATM. Actually we should allow registering an empty filter
> list for this purpose. This has been recently discussed on the socketcan
> list, but I'm not aware of any concrete result.

I have committed an update allowing the registration of an empty filter 
list. Have a look to the utility program "rtcansend.c" to see how to use it.

Wolfgang.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-03 15:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-23 12:11 [Xenomai-help] RTCAN: multiple sockets on one device Daniel Schnell
2006-11-23 15:44 ` Jan Kiszka
2006-11-23 16:29   ` Wolfgang Grandegger
2006-12-03 15:49   ` Wolfgang Grandegger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.