Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can still create the service client outside your loop as an automatic variable (ie. on the stack), and prevent the constant and unnecessary creation/destruction of multiple clients within the loop.

The template parameter is used to determine the type of messages to be used by the client, that is, the request and response types. Its type should not influence whether you create client instances on the stack or heap, or inside/outside a loop.