[interfacekit] Re: BSession(NG)
- From: Adi Oanca <adioanca@xxxxxxxxx>
- To: interfacekit@xxxxxxxxxxxxx
- Date: Fri, 07 May 2004 20:03:22 +0300
Hi!
Pahtz 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.
read_port(port_id id, int32 *protocol, void *msgBuffer, size_t bufferSize);
You are beginning to annoy me! I know what the BeBook says!
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 :-)
No? How is it then, that you know that? Hmmm... from the BeBook? Yes,
I think so!
IMO, the solution is to dynamically resize the receive buffer if necessary...
IMO, Marc's opinion, and in others' ones the solution is not to
allocate a buffer each time a message is received but to reuse the
first, the only, the last allocated buffer.
Please understand that!
I would also want what you want. Believe me! But memory
allocation/deallocation operations must be a few, especially on such a
port_write/read intensive program like app_server is.
You can call port_buffer_size() to find out the size of the message before
read_port();
ssize_t port_buffer_size(port_id id);
Oh wow! " that's news to me! :-|".
Please don't start teaching me! I know what there is to know about the
work I'm doing.
Adi.
---------------------------------------------------------------
Lucram pentru tine. Analizam. Cautam zilnic.
Alegem ceea ce te intereseaza. Te anuntam.
http://www.REDUCERI.ro/
- 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)
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.
read_port(port_id id, int32 *protocol, void *msgBuffer, size_t bufferSize);
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 :-)
You can call port_buffer_size() to find out the size of the message before read_port(); ssize_t port_buffer_size(port_id id);
- [interfacekit] Re: BSession(NG)
- From: Pahtz