Suggest a right approach if i wish to use response structure outside the callback

Suggest a right approach if i wish to use response structure outside t

In general I would recommend copying out the relevant fields you need into your own structure. I would need some more context in order to give better advice, though.

how can we set time out for connections .
Getting error Client-side timeout exceeded for operation . While doing load test

Try LCB_CNTL_OP_TIMEOUT. Use lcb_cntl: http://docs.couchbase.com/sdk-api/couchbase-c-client-2.5.6/group__lcb-cntl.html

     //change time out
      lcb_U32 newval = 4000000; // Set to 4 seconds
      int LCB_CNTL_OPTIMEOUT;
      lcb_cntl(instance, LCB_CNTL_SET, LCB_CNTL_OPTIMEOUT, &newval);

Still i get the same error

Please use logging to determine where the failure is happening. A timeout error may be caused by an unresponsive server, but is most likely caused by your network and/or firewall configuration.

See http://developer.couchbase.com/documentation/server/4.0/sdks/c-2.4/logging.html regarding how to enable logging (simply use LCB_LOGLEVEL=5 in the environment.