diff --git a/testApp/remote/Makefile b/testApp/remote/Makefile index b8393d4..1c0a57d 100644 --- a/testApp/remote/Makefile +++ b/testApp/remote/Makefile @@ -42,9 +42,9 @@ PROD_HOST += testServer testServer_SRCS += testServer.cpp testServer_LIBS += pvData pvAccess Com -PROD_HOST += pvaget -pvaget_SRCS += pvaget.cpp -pvaget_LIBS += pvData pvAccess Com +PROD_HOST += pvget +pvget_SRCS += pvget.cpp +pvget_LIBS += pvData pvAccess Com include $(TOP)/configure/RULES #---------------------------------------- diff --git a/testApp/remote/pvaget.cpp b/testApp/remote/pvget.cpp similarity index 94% rename from testApp/remote/pvaget.cpp rename to testApp/remote/pvget.cpp index 11b314a..5f08a7d 100644 --- a/testApp/remote/pvaget.cpp +++ b/testApp/remote/pvget.cpp @@ -341,13 +341,13 @@ PVStructure::shared_pointer pvRequest; void usage (void) { - fprintf (stderr, "\nUsage: pvaget [options] ...\n\n" + fprintf (stderr, "\nUsage: pvget [options] ...\n\n" " -h: Help: Print this message\n" "options:\n" " -r : Request, specifies what fields to return and options, default is '%s'\n" " -w : Wait time, specifies timeout, default is %f second(s)\n" " -t: Terse mode - print only value, without name" - "\nExample: pvaget example001 \n\n" + "\nExample: pvget example001 \n\n" , DEFAULT_REQUEST, DEFAULT_TIMEOUT); } @@ -488,7 +488,7 @@ public: * * Function: main * - * Description: pvaget main() + * Description: pvget main() * Evaluate command line options, set up CA, connect the * channels, print the data as requested * @@ -527,12 +527,12 @@ int main (int argc, char *argv[]) break; case '?': fprintf(stderr, - "Unrecognized option: '-%c'. ('pvaget -h' for help.)\n", + "Unrecognized option: '-%c'. ('pvget -h' for help.)\n", optopt); return 1; case ':': fprintf(stderr, - "Option '-%c' requires an argument. ('pvaget -h' for help.)\n", + "Option '-%c' requires an argument. ('pvget -h' for help.)\n", optopt); return 1; default : @@ -544,7 +544,7 @@ int main (int argc, char *argv[]) int nPvs = argc - optind; /* Remaining arg list are PV names */ if (nPvs < 1) { - fprintf(stderr, "No pv name specified. ('pvaget -h' for help.)\n"); + fprintf(stderr, "No pv name specified. ('pvget -h' for help.)\n"); return 1; } @@ -568,11 +568,25 @@ int main (int argc, char *argv[]) bool allOK = true; - // for now a simple iterating sync implementation, guarantees order + // first connect to all, this allows resource (e.g. TCP connection) sharing + vector channels(nPvs); for (int n = 0; n < nPvs; n++) { + shared_ptr channelRequesterImpl(new ChannelRequesterImpl()); + channels[n] = provider->createChannel(pvs[n], channelRequesterImpl); + } + + // for now a simple iterating sync implementation, guarantees order + for (int n = 0; n < nPvs; n++) + { + /* shared_ptr channelRequesterImpl(new ChannelRequesterImpl()); Channel::shared_pointer channel = provider->createChannel(pvs[n], channelRequesterImpl); + */ + + Channel::shared_pointer channel = channels[n]; + shared_ptr channelRequesterImpl = dynamic_pointer_cast(channel->getChannelRequester()); + if (channelRequesterImpl->waitUntilConnected(timeOut)) { shared_ptr getRequesterImpl(new ChannelGetRequesterImpl(channel->getChannelName()));