[interfacekit] Re: Port Messaging
- From: "Erik Jakowatz" <erik@xxxxxxxxxxxxxx>
- To: interfacekit@xxxxxxxxxxxxx
- Date: Wed, 28 Nov 2001 22:00:09 -0800
>>As Dianne said recently most messaing to the app_server is
>>not BMEssage based, however. Though you'd entitled to answer
>>by pointing out that this paprticular kind of message (CREATE_APP)
>>is not a bottleneck/CPU-intensive one.
>I saw this kind of usage done in AtheOS and I thought it might be
useful.
>What would you suggest? Obviously, this is not my area of expertise.
Well, for the particular example you're giving, you could do it the hard
way:
int32 msgSize =
sizeof (int32) + // for the CREATE_APP opcode
strlen(signature) + 1 // one extra for null terminator
sizeof (int32); // for the port id
uchar* buffer = new uchar[msgSize];
uchar* bp = buffer;
*(int32*)bp = CREATE_APP;
bp += sizeof (int32);
strcpy(bp, signature);
bp += strlen(signature);
*bp = '\0';
++bp;
*(int32*)bp = messageport;
write_port(serverport, CREATE_APP, buffer, msgSize);
But that would just be a pain in the rear. =) I think the smartest
thing to do is for us to create a class which abstracts the buffer
management, so we can do this:
BAppServerLink Server(serverport);
Server << CREATE_APP;
Server << signature;
Server << messageport;
Server.Flush();
Or perhaps
BAppServerLink Server(serverport);
Server.SetOpcode(CREATE_APP);
Server << signature;
Server << messageport;
Server.Flush();
Anyway, I'm sure you get the idea. As Cedric pointed out, you could get
away with using BMessage for in this particular instance, but generally
all messaging to app_server should be done as straight binary data
streams. Communication with app_server needs to be as close to
real-time as possible, and BMessages just aren't going to cut it there.
e
Data is not information, and information is not knowledge: knowledge is
not understanding, and understanding is not wisdom.
- Philip Adams
- Follow-Ups:
- [interfacekit] Re: Port Messaging
- From: Cedric Degea
- References:
- [interfacekit] Re: Port Messaging
- From: DarkWyrm
Other related posts:
- » [interfacekit] Port Messaging
- » [interfacekit] Re: Port Messaging
- » [interfacekit] Re: Port Messaging
- » [interfacekit] Re: Port Messaging
- » [interfacekit] Re: Port Messaging
- » [interfacekit] Re: Port Messaging
- » [interfacekit] Re: Port Messaging
- » [interfacekit] Re: Port Messaging
- » [interfacekit] Re: Port Messaging
- [interfacekit] Re: Port Messaging
- From: Cedric Degea
- [interfacekit] Re: Port Messaging
- From: DarkWyrm