I apologize for the late response again. You probably already figured this
out by now but
You could also do builder -> AddListeningPort("*address*:0", creds,
&selected_port)
(i.e pass port number as "0" when you pass the address to AddListeningPort
API) and this picks an available port and returns via selected_port
(The only issue with this is that you will then have to figure out a way to
let your client know what the server port is. This is why, we use a 'port
server' utility in our unit tests that I mentioned earlier..Yes, It does
have the issue you mentioned in theory- i.e the port might be used by some
other process between the port check and BuildAndStart)
-Sree
On Wednesday, December 6, 2017 at 7:09:25 AM UTC-8, tfzk wrote:
>
>
> Thanks for the answer.
>
> I understand that the BuildAndStart() method is not save for that doing.
>
> But my problem is an other thing.
> What is if the port get used from an other process in between the port
> check and the BuildAndStart() call? -> The ServerBuilder comes in a strange
> state.
>
> -> I can not use the ServerBuilder in my process again. I can not reset
> the ServerBuilder.
> If I call the BuildAndStart(...) again an exception occured. That is
> my problem.
>
> -> 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
>
> -> And the ServerBuilder could only instantiate once
>
>
> *.Is there any solutions for this problem or is this a bug or missing
> functionality in the ServerBuilder class?*
> 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 [email protected].
To post to this group, send email to [email protected].
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/0b1044d1-f871-4723-936c-69a8d4443215%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.