Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 913 Bytes

HOW-TO-BUILD-GRPC-SERVER-SIDE.md

File metadata and controls

29 lines (23 loc) · 913 Bytes

How to build gRPC server-side

This chapter will explain how was gRPC built in server-side.

source code

private void start() throws IOException {
    /* The port on which the server should run */
    int port = 50051;
    server = ServerBuilder.forPort(port)
        .addService(new GreeterImpl())
        .build()
        .start();
  }

interpretation

There are four steps to build Server, ServerBuilder.forPort, ServerBuilder.addService, ServerBuilder.build and ServerBuilder.start respectively.

  • ServerBuilder.forPort() forPort
  • ServerBuilder.addService() addService
  • ServerBuilder.build() build
  • ServerBuilder.start() start