Ask Your Question
1

When to change the buffer size parameter of advertise function

asked 2012-06-30 02:25:15 -0500

li-an gravatar image

updated 2012-07-01 10:48:35 -0500

Eric Perko gravatar image

follow:topic Tutorials

I try to change the parameter of the advertise of buffer of size.

For example,I tried 1,200,1000,2000,...etc.

But I can't find their difference.

What are the cases of changing that parameter ?

Is there any sample code ?

Thank you !!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-01-16 19:13:55 -0500

kalectro gravatar image

You will see the effect only under certain circumstances. First make sure you know what a buffer is used for, then you could try the following:

set the buffer size to 1 and publish 100 messages right after another by writing something like

for (int i=0;i<100;++i)

pub.publish(message);

This will publish the message 100 times but will most likely not be received that often. What happens is the following: If your code publishes a message, it will overwrite the last message which is still waiting in the buffer for transmission. How many messages will be received by the subscriber will depend on the network connection between the publisher and the subscriber.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-06-30 02:25:15 -0500

Seen: 1,311 times

Last updated: Jan 16 '13