[interfacekit] Re: BSession(NG)

Adi Oanca <adioanca@xxxxxxxxx> wrote:

> Marcus Overhagen wrote:
> > I have done TCP/IP, RS485, BMessage and media kit port based communication
> > before, and I can assure you that there is really no need to have START and 
> > END
> > codes, reassembly of splitted buffers dynamic resizing of buffers, etc.
> > 
> > I also have some great ideas about how to *optimize* the port link 
> > communication,
> > but I didn't want to disturbe app_server development by doing such large 
> > changes
> > (even if they would simplyfiy and most likely speed up the communication)
>       Do not worry about that!
>       Let's hear them!

Well, basically most of it has been said by me and Ingo.

The general idea is to use medium sized static buffers, to avoid
too high latencies in server communication. Small parameters,
up to a certain size can be passed inline with the message code,
(for example, region data up to 1 kB), others must be passed in a
shared area (the application creates it, passes the id to the server,
and the server deletes it).

Messages have a fixed maximum size, and start with an opcode
and a length field. No splitting or reassembly or dynamic buffer
resizing is done (except creating/deleting areas for large data).
Receiveing on the server side can also be done into a fixed size buffer.
Unkown messages can be ignored by the server.
When creating a message, parameters must be validated first,
and if required, the buffer must be flushed first (is should be at least 2/3
full for the biggest message). Then the full message needs to be written,
and there would be no support to interrupt that (well, you could remember
the start position in the buffer, and restore it, if you really need to 
terminate
message creation).

At the end of the BWindow::DispatchMessage() or some other appopriate
place, the buffer would be always flushed, to insure that all drawing
calls are executed.

What remains is to provide a example implementation of this,
but right now I'm pretty busy, especially with development
of the Gigabit Ethernet drivers, so I won't do it until requested.

regards
Marcus




Other related posts: