Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
.gitignore | H A D | 25-Apr-2025 | 22 | 3 | 2 | |
README.md | H A D | 25-Apr-2025 | 1.5 KiB | 51 | 35 | |
async_greeter_client.py | H A D | 25-Apr-2025 | 1.2 KiB | 38 | 18 | |
async_greeter_server.py | H A D | 25-Apr-2025 | 1.5 KiB | 48 | 26 | |
greeter_client.py | H A D | 25-Apr-2025 | 1.2 KiB | 37 | 16 | |
greeter_server.py | H A D | 25-Apr-2025 | 1.4 KiB | 44 | 22 | |
helloworld_pb2.py | H A D | 25-Apr-2025 | 1.4 KiB | 31 | 18 | |
helloworld_pb2.pyi | H A D | 25-Apr-2025 | 576 | 18 | 14 | |
helloworld_pb2_grpc.py | H A D | 25-Apr-2025 | 2.3 KiB | 71 | 55 |
README.md
1# Unix Domain Socket Example in gRPC Python 2 3## Check Our Guide First 4 5For knowing the basics of gRPC Python and the context around the helloworld example, please checkout our gRPC Python [Quick Start guide](https://grpc.io/docs/languages/python/quickstart). 6 7## Overview 8 9This example demonstrate how gRPC Python can utilize the gRPC Name Resolution mechanism to specify UDS address for clients and servers. The gRPC Name Resolution mechanism is documented at https://github.com/grpc/grpc/blob/master/doc/naming.md. 10 11Specifically, this example will bind the server to the following UDS addresses, and use clients to connect to them: 12 13* `unix:path`: setting the unix domain socket path relatively or absolutely 14* `unix://absolute_path`: setting the absolute path of the unix domain socket 15 16## Prerequisite 17 18The Python interpreter should have `grpcio` and `protobuf` installed. 19 20## Running The Example 21 22Starting the server: 23 24``` 25$ python3 greeter_server.py 26INFO:root:Server listening on: unix:helloworld.sock 27INFO:root:Server listening on: unix:///tmp/helloworld.sock 28... 29``` 30 31``` 32$ python3 async_greeter_server.py 33INFO:root:Server listening on: unix:helloworld.sock 34INFO:root:Server listening on: unix:///tmp/helloworld.sock 35... 36``` 37 38Connecting with a client: 39 40``` 41$ python3 greeter_client.py 42INFO:root:Received: Hello to unix:helloworld.sock! 43INFO:root:Received: Hello to unix:///tmp/helloworld.sock! 44``` 45 46``` 47$ python3 async_greeter_client.py 48INFO:root:Received: Hello to unix:helloworld.sock! 49INFO:root:Received: Hello to unix:///tmp/helloworld.sock! 50``` 51