Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

@Philip is right. The publisher need some time to connect to the subscribers. Your finite loop is just to short for that. I'm not sure what you expect from you condition case in the infinite loop as that is never true.

The proper solution to your problem is to use pub.getNumSubscribers() and wait until that is > 0. Then publish.