I have a start-up sequence I stole from an example, and it works just fine, as long as the port I am binding to is available.
std::string server_address("0.0.0.0:80");
grpc::ServerBuilder builder;
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
builder.RegisterService(....);
std::unique_ptr<grpc::Server> server(builder.BuildAndStart());However, when the port is unavailable, the call to BuildAndStart seems to never return (well, for the values of "never" as large as 5 minutes in my tests).
Is there a way to have the call fail quickly on binding failure? Is there a retry policy or something else that controls this behavior?
There are 2 messages logged:
E0328 14:25:16.763000000 2240 tcp_server_windows.c:174] bind addr=[::]:80: An attempt was made to access a socket in a way forbidden by its access permissions.
E0328 14:25:16.763000000 2240 server_chttp2.c:115] No address added out of total 1 resolved
-kkm