I will use the ServerBuilder to create an service with one of a port of *my defined port range* ( e.g. 50001 to 50100 ) If one port is used I will use the next one.
*Is this possible and how is this working? I will not check for free port before.* I tried the following: - instantiate the builder - add completion queue - add one of the port to builder -> AddListeningPort(L"0.0.0.0:50001", grpc::InsecureServerCredentials() - instantiate new service - register service - and call BuildAndStart() - if nullptr returned I try it again with an other port. *-> this is not working. An exception occured ( Unhandled exception at 0x0f365dc4 (xxxx.dll) in xxxx.exe: 0xC0000005: Access violation reading location 0xfeeefef2. )in method has_synchronous_methods() at for loop* bool has_synchronous_methods() const { for (auto it = methods_.begin(); it != methods_.end(); ++it) { if (*it && (*it)->handler() != nullptr) { return true; } } return false; } Here is my code (simplyfied): void MyService::Run( ) { ServerBuilder builder; _completionQueue = builder.AddCompletionQueue(); for( int portNumber = 50000; portNumber <= 50100; portNumber++ ) { _runningService = std::make_shared<MyServiceBase>(); builder.AddListeningPort( _address + ":" + std::to_string( portNumber ), grpc::InsecureServerCredentials(), &_port); builder.RegisterService( _runningService.get() ); _server = builder.BuildAndStart(); if( !_server ) return; } HandleRpcs(); } Thanks in advanced. Kind regards -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To post to this group, send email to grpc-io@googlegroups.com. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/d339c967-dbcb-4c6a-ac0a-3fa74d190c34%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.