Re: recvfrom() strange operation



kzsolt@xxxxxxxxxx wrote:
"Any reason not go always supply a buffer at least as big as your
datagram?"
Our application is a reliable protocol running in separated threads and
theoretically working over TCP and UDP too. If I have no chance to
retrive packet content by bytes then the only way is implement
additional buffering. But this buffering is triple buffering in our
stack instead of double buffering. This cost mouch CPU and time too.

Not sure what you mean by buffering, but since you indicate that
it has a CPU overhead, I'd guess you mean copying the data
rather than just queueing. If that's the case, you might want to
take a careful look at the design. The one copy from kernel to
user space (in the case of incoming data) would normally be the
only copy you need to do. Any other copying as it moves
through the layers of the protocol stack is probably a poor
design.

And of course I write the same algorithm already in the kernel...

I don't quite follow this part either. If some code exists within
the kernel and implements a portion of your protocol stack
(analyzing some bytes of the message), then why would this
same code exist within user space? And you you are
accessing TCP/UDP using recvfrom(), what do you have in
the kernel?

Regards,
Steve
------------------------------------------------------------------------
Steve Schefter phone: +1 705 725 9999 x26
The Software Group Limited fax: +1 705 725 9666
642 Welham Road,
Barrie, Ontario CANADA L4N 9A1 Web: www.wanware.com

.



Relevant Pages

  • Re: simple read char app return wrong value?
    ... so bash can read input meant for us, but we could also read input meant for bash i suppose... ... linux kernel also wants posic compliance so it also implements the same methods. ... the posix functions in libc just immidiately call the linux syscalls. ... A C program that reads a file one character at a time with fgetcis much faster, because of this internal buffering. ...
    (alt.lang.asm)
  • Re: [PATCH] [REPOST] x86_64, i386: Add command line length to boot protocol
    ... Boot protocol 2.02 introduced the null terminated string truncated by ... of the command line the kernel can understand. ...
    (Linux-Kernel)
  • Re: recvfrom() strange operation
    ... "Any other copying as it moves through the layers of the protocol stack ... To receive UDP or TCP packet you need some buffering of received data. ...
    (comp.os.linux.development.system)
  • RE: [Linux-cluster] Re: [cgl_discussion] Re: [dcl_discussion] Clustersummit materials
    ... On Wed, 2004-08-11 at 11:19, Walker, Bruce J wrote: ... > Given cman etc. was written for GFS, it doesn't prove much that it works ... I have looked over the cman protocol and find it is suboptimal. ... virtual synchrony to the kernel. ...
    (Linux-Kernel)
  • Re: THE LINUX/I386 BOOT PROTOCOL - Breaking the 256 limit
    ... I've found that 256 bytes long kernel parameters are not enough ... I've added an entry in the kernel configuration menu so that I ... > and once for the new protocol not truncated. ... thus truncating it to 256. ...
    (Linux-Kernel)