Send() Receive() Reply()" with 65KByte?

Hi Community,

how is it possible to send under QNX4 with “Send() Receive() Reply()” 65KByte Data with Message Passing is it possible or not?

Is it Possible to send 65KByte with “MsgSend() MsgReceive() MsgReply()” under ONX Neutrino too?

If I try to send Date over 32KByte a Stack error is the result.

My string is build as follows:

unsigned char string[BLOCKSIZE];
while (i < BLOCKSIZE )
string[i++] = ‘x’;

string[BLOCKSIZE] = ‘\0’;

Thank you

With QNX4, tt’s possible but not if going over a network.

With QNX6 it’s possible too by you have to call a fonction which I don’t recall at this time to get data over 8k. (could be wrong on the exact size)

As for stack error

index start a 0, hence string[BLOCKSIZE] = 0 write one byte past the buffer.

while ( i < BLOCKSIZE )
string[i++] = 0;

Is odd looking,

More typical is

for ( i=0; i < BLOCKSIZE; i++ )
string[i] = 0;

you get the benifit of initialisating i in the same line.

Thank you mario !!

So the only thing I have to change is better looking
and replace ‘x’ with 0.

But the Array is further a character Array ?

In QNX6 you can send any size. If your receive buffer is not large enough, you use MsgRead to fetch the unreceived part(s).

That’s not how it works when networking is involved. Because it’s actually the size of the network stack buffer that is the limit. Check out section on native networking in qnx.com/developers/docs/mome … ceive.html

As for replacing x with 0, then better then the for loop is

memset( string, 0, sizeof ( string ) );

No this don’t works neither replacing x with 0, nor memset(string, 0,sizeof(string))
are the answer.
I have anymore an stack error.
Does anybody have further proposals ???

Thank you !!!

Why not increase your stacksize? I believe under QNX4 it was the -N option to cc?

Yep -N. You can make it real big as stack is allocated on demand, only virtual page marker are preallocated. I think the default is 32k.

Thank You cburgess and mario !!!

the -N option works, so it is possible to increase the Blocksize
as high as I needed I’ve try it up to 1024k and it works.

Does it gives a possibility to increase the Stacksize out of a Programm?

Thanks !!!

As far as I know you cannot increase the stack size. However your program could restart itself as a thread (begin_thread) and specify a bigger stack. Quite ugly solution.

For big chunk of data, you could dynamicaly allocated the memory with malloc.

Thank you mario

I’ve try it with malloc and it works perfect.

But malloc allocates memory in the Heap and not in the Stack like the -N option
so why it works?

If I allocate memory with alloca() in the Stack it dont works and I have to link
with -N option so why it works not?

Thank You !!!

For malloc, the hea grow dynamicaly, the limit is the amount of ram available.

As for the alloca indeed memory is allocated on the stack but the stack is limited by the -N parameter.

Thank you mario,

so regardless of which memory allocated, Stack or Heap it works?
in this case it is the same?

Sure memory is memory ;-)

What do you mean by is it the same?

Thank you mario

because the Stack ist only for, funcition-calls and local variables.
and the Heap ist only for, dynamic memory.

Is this not true?

Yes it’s true, but in the end, all that memory comes from the physical memory chip which doesn’t give a damn about stack or heap ;-)

Ok thank’s mario!!!