lkml.org 
[lkml]   [1999]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: how do I direct raw packages to a given socket?
Quoting Andi Kleen (ak@muc.de):
> no, this does not work. sock is a pointer. filedescriptor is a index.
ok, did not know that.
> if you want to multiplex it you would need to write a kernel
> protocol family that can supply multiple sockets.
I will try to do a userspace-daemon to check things out, first.
> If the problem is not very performance critical you can get around it
> with a small user space library that binds a packet socket to
> MCAT_PROTO and then does something like:
> /* only receive header */
> n = recv(packet_sk, buf, headerlen, MSG_PEEK);
> if (n <= headerlen) error();
> if (header is for me) {
> n = recv(packet_sk, buf, buflen, 0);
> Basically the MSG_PEEK avoids the full data copy if the packet
> is not for you. But it would still eat a lot of context switches,
> but for low speed networking (e.g. <= 64kbit/s) that should be no
> problem for modern CPUs.
I am on an embedded system and the processor is not mighty fast. But thanks
for the info. I will put your input to use.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.067 / U:0.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site