[interfacekit] Re: BSession(NG)
- From: "Marcus Overhagen" <ml@xxxxxxxxxxxx>
- To: interfacekit@xxxxxxxxxxxxx
- Date: Sat, 08 May 2004 00:20:59 GMT
Pahtz <pahtz@xxxxxxxxxxxx> wrote:
> BTW, excuse me if you know already but read_port() is not like a socket or
> file descriptor. You
> will lose data if the bufferSize is too small. You can't read_port() twice on
> the same message.
Doesn't matter if you use fixed size buffers.
> So with your code, the receiver better have set a buffersize larger than or
> equal to what the
> sender set. This is an ugly dependency. Please don't tell me we can solve it
> with pretty
> documentation :-)
It's not ugly. You need to use a fixed maximum buffer size.
> IMO, the solution is to dynamically resize the receive buffer if necessary...
Resizing buffers adds unnecessary complexity, and might be slower.
> You can call port_buffer_size() to find out the size of the message before
> read_port();
That should have a about the same overhead (slowdown) as calling write_port()
twice.
Adding the overhead of realloc (which does locking, searching for a free
buffer, etc)
it will surely be slower.
> It's simple, it works. One malloc() call or none if the buffer is already
> large enough.
You need to add one free() and one port_buffer_size() plus the realloc() calls
on the
sender size, plus the overhead of dealing with variable buffer sizes.
I really don't understand why you propose this change. It has no benefit.
regards
Marcus Overhagen
- Follow-Ups:
- [interfacekit] Re: BSession(NG)
- From: Pahtz
- References:
- [interfacekit] Re: BSession(NG)
- From: Pahtz
Other related posts:
- » [interfacekit] BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- » [interfacekit] Re: BSession(NG)
- [interfacekit] Re: BSession(NG)
- From: Pahtz
- [interfacekit] Re: BSession(NG)
- From: Pahtz